diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 15 | ||||
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 9 |
2 files changed, 24 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 2a8882171f..b855fb7da2 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,18 @@ +* Add `--migrations_paths` option to migration generator. + + If you're using multiple databases and have a folder for each database + for migrations (ex db/migrate and db/new_db_migrate) you can now pass the + `--migrations_paths` option to the generator to make sure the the migration + is inserted into the correct folder. + + ``` + rails g migration CreateHouses --migrations_paths=db/kingston_migrate + invoke active_record + create db/kingston_migrate/20180830151055_create_houses.rb + ``` + + *Eileen M. Uchitelle* + * Deprecate `rake routes` in favor of `rails routes`. *Yuji Yaginuma* diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 657a56354b..5c57d607fc 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -254,6 +254,15 @@ class MigrationGeneratorTest < Rails::Generators::TestCase end end + def test_migrations_paths_puts_migrations_in_that_folder + run_generator ["create_books", "--migrations_paths=db/test_migrate"] + assert_migration "db/test_migrate/create_books.rb" do |content| + assert_method :change, content do |change| + assert_match(/create_table :books/, change) + end + end + end + def test_should_create_empty_migrations_if_name_not_start_with_add_or_remove_or_create migration = "delete_books" run_generator [migration, "title:string", "content:text"] |