diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-08-30 12:15:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-30 12:15:26 -0400 |
commit | 9f1d8f9e3d9d65f0888195073f0f8a56f7ab787d (patch) | |
tree | 4f13fbb920602888f99b45697f79e3f3ed353742 /activerecord | |
parent | ed06a638cdb194aa2ebbfa5bab4cbb5f1ae5ef04 (diff) | |
parent | b551a707552598bd0134a6ebecb076f0f7edeaa1 (diff) | |
download | rails-9f1d8f9e3d9d65f0888195073f0f8a56f7ab787d.tar.gz rails-9f1d8f9e3d9d65f0888195073f0f8a56f7ab787d.tar.bz2 rails-9f1d8f9e3d9d65f0888195073f0f8a56f7ab787d.zip |
Merge pull request #33760 from eileencodes/add-migrations_paths_option-to-migration-generator
Add migrations_paths option to migration generator
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/migration.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/rails/generators/active_record/migration/migration_generator.rb | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/rails/generators/active_record/migration.rb b/activerecord/lib/rails/generators/active_record/migration.rb index 4ceb502c5d..4a17082d66 100644 --- a/activerecord/lib/rails/generators/active_record/migration.rb +++ b/activerecord/lib/rails/generators/active_record/migration.rb @@ -24,7 +24,9 @@ module ActiveRecord end def db_migrate_path - if defined?(Rails.application) && Rails.application + if migrations_paths = options[:migrations_paths] + migrations_paths + elsif defined?(Rails.application) && Rails.application Rails.application.config.paths["db/migrate"].to_ary.first else "db/migrate" diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb index a07b00ef79..281b7afb50 100644 --- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb @@ -8,6 +8,7 @@ module ActiveRecord argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]" class_option :primary_key_type, type: :string, desc: "The type for primary key" + class_option :migrations_paths, type: :string, desc: "The migration path for your generated migrations. If this is not set it will default to db/migrate" def create_migration_file set_local_assigns! |