active_record_migrations 5.0.1.1 → 6.1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +11 -9
- data/active_record_migrations.gemspec +2 -8
- data/lib/active_record_migrations.rb +3 -2
- data/lib/active_record_migrations/generators/migration.rb +2 -5
- data/lib/active_record_migrations/tasks/new_migration.rake +10 -3
- data/lib/active_record_migrations/version.rb +1 -1
- metadata +11 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 247981e1e8e1dd7818c7ef0bde4b39d03282fe87a416f1b2e85cd49da49993aa
|
4
|
+
data.tar.gz: 522199fd3e52230a0c628618632cba5ea41858c7c2ee50345b0ecdecbe3983a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dab1abc43654f7768e9176daf5dda90c2b43bf5bf5c3e80dc96409c6457183ed08185ea2f91a5d598e4a2528796b96afd4cd2d9f02ae408c40e4e8755ab812b
|
7
|
+
data.tar.gz: 498b179029d01cef1a3cb89c5a20b599303e1ee4c388067e6542e2caa8fef66232a1063af0e9f52cf20a8241fd2a6b6b69621f0fbf8b916cb0d07e5c2de791bd
|
data/README.md
CHANGED
@@ -71,18 +71,20 @@ You can specify the environment by setting the `db` environment variable:
|
|
71
71
|
|
72
72
|
## Versioning
|
73
73
|
|
74
|
-
|
75
|
-
|
74
|
+
From ActiveRecord 5.0.2 and above you should use v5.0.2.1 or above. That version isn't locked to
|
75
|
+
ActiveRecord 5.0.2 as in previous versions, which means it should work fine with any ActiveRecord
|
76
|
+
version starting with 5.0.2.
|
76
77
|
|
77
|
-
|
78
|
+
Up to ActiveRecord 5.0.1 we relied on overriding a method in the migration generator to support
|
79
|
+
custom paths for the migrations, so the version used to follow ActiveRecord versions plus a
|
80
|
+
patch version from our own. For instance, if AR version is 4.0.1, this gem would be versioned
|
81
|
+
4.0.1.x with x starting in 0.
|
78
82
|
|
79
|
-
|
80
|
-
order to override the migrations path. So far the internal implementation since 4.0.0.0 hasn't
|
81
|
-
changed, so if you're interested on another version with optimistic versioning dependency in
|
82
|
-
order to have more flexibility you should check out the [optimistic](../../tree/optimistic) branch.
|
83
|
+
## I can't find a release for the AR version we rely on
|
83
84
|
|
84
|
-
|
85
|
-
|
85
|
+
We had to use pessimistic versioning up to 5.0.1.1 because we relied on internal details of AR
|
86
|
+
migrations in order to override the migrations path. The [optimistic](../../tree/optimistic)
|
87
|
+
branch should work with any previous version since ActiveRecord 4.0.0.
|
86
88
|
|
87
89
|
## Contributing
|
88
90
|
|
@@ -20,13 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_dependency "rake"
|
23
|
-
|
24
|
-
|
25
|
-
# We rely on a kind of monkey patch for allowing us to override the migrations path.
|
26
|
-
# So it's better to fix on an specific version of AR and check if the override of
|
27
|
-
# ActiveRecord::Generators::MigrationGenerator#create_migration_file is correct
|
28
|
-
# before upgrading AR dependency. See ARM::Generators::MigrationGenerator impl.
|
29
|
-
spec.add_dependency "railties", "5.0.1"
|
30
|
-
spec.add_dependency "activerecord", "5.0.1"
|
23
|
+
spec.add_dependency "railties", ">= 6.1.1"
|
24
|
+
spec.add_dependency "activerecord", ">= 6.1.1"
|
31
25
|
end
|
32
26
|
|
@@ -20,15 +20,16 @@ module ActiveRecordMigrations
|
|
20
20
|
def self.load_tasks
|
21
21
|
create_rails_app_if_not_exists
|
22
22
|
|
23
|
-
load
|
23
|
+
load 'active_record/railties/databases.rake'
|
24
24
|
load 'active_record_migrations/tasks/new_migration.rake'
|
25
25
|
|
26
26
|
ActiveRecord::Base.schema_format = configurations.schema_format
|
27
27
|
DatabaseTasks.env = configurations.environment
|
28
|
+
Rails.env = DatabaseTasks.env
|
28
29
|
DatabaseTasks.seed_loader = configurations.seed_loader
|
29
30
|
ActiveRecord::Base.configurations = DatabaseTasks.database_configuration =
|
30
31
|
configurations.database_configuration
|
31
|
-
|
32
|
+
ActiveRecord::Base.establish_connection ActiveRecord::Tasks::DatabaseTasks.env.to_sym
|
32
33
|
DatabaseTasks.db_dir = configurations.db_dir
|
33
34
|
DatabaseTasks.migrations_paths = configurations.migrations_paths
|
34
35
|
DatabaseTasks.root = Rails.root
|
@@ -6,11 +6,8 @@ module ActiveRecordMigrations
|
|
6
6
|
class MigrationGenerator < ::ActiveRecord::Generators::MigrationGenerator
|
7
7
|
source_root ::ActiveRecord::Generators::MigrationGenerator.source_root
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
validate_file_name!
|
12
|
-
dir = ::ActiveRecord::Tasks::DatabaseTasks.migrations_paths.first
|
13
|
-
migration_template @migration_template, "#{dir}/#{file_name}.rb"
|
9
|
+
def db_migrate_path
|
10
|
+
::ActiveRecord::Tasks::DatabaseTasks.migrations_paths.first
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
@@ -4,8 +4,12 @@ require 'active_record/tasks/database_tasks'
|
|
4
4
|
require 'active_record_migrations/configurations'
|
5
5
|
require 'active_record_migrations/generators/migration'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
deps = []
|
8
|
+
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('5.2.0')
|
9
|
+
deps << 'db:load_config'
|
10
|
+
end
|
11
|
+
task environment: deps do
|
12
|
+
ActiveRecord::Base.establish_connection ActiveRecord::Tasks::DatabaseTasks.env.to_sym
|
9
13
|
end
|
10
14
|
|
11
15
|
namespace :db do
|
@@ -16,7 +20,8 @@ namespace :db do
|
|
16
20
|
|
17
21
|
unless name
|
18
22
|
generator = Rails::Generators.find_by_namespace "migration"
|
19
|
-
desc = generator.desc.gsub(/`rails (?:g|generate) migration (\w+)`/,
|
23
|
+
desc = generator.desc.gsub(/`rails (?:g|generate) migration (\w+)`/,
|
24
|
+
'`rake "db:new_migration[\\1]"`' ).
|
20
25
|
gsub(/`rails (?:g|generate) migration (\w+) (.*)`/, '`rake "db:new_migration[\\1, \\2]"`' )
|
21
26
|
puts [
|
22
27
|
%Q{Usage: rake "#{t.name}[AddFieldToForm[, field[:type][:index]] field[:type][:index]]"},
|
@@ -26,6 +31,8 @@ namespace :db do
|
|
26
31
|
end
|
27
32
|
params = [name]
|
28
33
|
params.concat options.split(' ') if options
|
34
|
+
# Rails assumes configure! has been called, which initializes @after_generate_callbacks
|
35
|
+
Rails::Generators.after_generate_callbacks # ensure the empty array is created
|
29
36
|
#Rails::Generators.invoke "active_record:migration", params,
|
30
37
|
Rails::Generators.invoke "active_record_migrations:migration", params,
|
31
38
|
behavior: :invoke, destination_root: Rails.root
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Rosenfeld Rosas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 6.1.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 6.1.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 6.1.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 6.1.1
|
69
69
|
description: ActiveRecord Stand-alone migrations
|
70
70
|
email:
|
71
71
|
- rr.rosas@gmail.com
|
@@ -103,10 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.5.1
|
106
|
+
rubygems_version: 3.2.15
|
108
107
|
signing_key:
|
109
108
|
specification_version: 4
|
110
109
|
summary: Use AR migrations from outside of a Rails project
|
111
110
|
test_files: []
|
112
|
-
has_rdoc:
|