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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 79d435e92c6fee58d54e8fa7a547e15bfc3a12b9
4
- data.tar.gz: 4d141db8124b79c1b8b76c5b7053c910df58f07d
2
+ SHA256:
3
+ metadata.gz: 247981e1e8e1dd7818c7ef0bde4b39d03282fe87a416f1b2e85cd49da49993aa
4
+ data.tar.gz: 522199fd3e52230a0c628618632cba5ea41858c7c2ee50345b0ecdecbe3983a2
5
5
  SHA512:
6
- metadata.gz: 140c1246602a946c0d189780236f55bd093474e1960f99c73ed79f410be6ad67f863c9b32712b7f688fb26504618a5f5092b46f8ee730616132349995ba78df3
7
- data.tar.gz: d2ee0aa567eb0f7d28905ff54d2058a6f54279efd66cb87548c2b9a9edf2b7508dde6493be803b58a5ff800cf5f26acd151065889f7398b14cde01e6490d3285
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
- The version follows ActiveRecord versions plus a patch version from our own. For instance, if
75
- AR version is 4.0.1, this gem will be versioned 4.0.1.x with x starting in 0.
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
- ## I can't find a release for the AR version we rely on
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
- We have to use pessimistic versioning because we rely on internal details of AR migrations in
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
- I've already tried to merge the required changes to AR itself a few times but after having my
85
- pull requests ignored a few times without feedback I gave up.
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
- # spec.add_dependency "railties", "~> 5.0.1"
24
- # spec.add_dependency "activerecord", "~> 5.0.1"
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 "active_record/railties/databases.rake"
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
- DatabaseTasks.current_config = configurations.database_configuration[configurations.environment]
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 create_migration_file
10
- set_local_assigns!
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
- task environment: 'db:load_config' do
8
- ActiveRecord::Base.establish_connection ActiveRecord::Tasks::DatabaseTasks.current_config
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+)`/, '`rake "db:new_migration[\\1]"`' ).
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
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordMigrations
2
- VERSION = "5.0.1.1"
2
+ VERSION = '6.1.1.2'
3
3
  end
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: 5.0.1.1
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: 2016-12-28 00:00:00.000000000 Z
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: 5.0.1
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: 5.0.1
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: 5.0.1
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: 5.0.1
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
- rubyforge_project:
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: