diff options
author | Emil Soman <emil.soman@gmail.com> | 2014-02-05 13:02:38 +0530 |
---|---|---|
committer | Emil Soman <emil.soman@gmail.com> | 2014-02-06 17:38:31 +0530 |
commit | 8806768e9f1a2648085f7826d9a0032457182bdb (patch) | |
tree | 95ec57462acee1c0b0c86c3e028345ece70d50ea /railties/test/application/rake | |
parent | 90794325cfcc0502398c23a9f8db0017270121a7 (diff) | |
download | rails-8806768e9f1a2648085f7826d9a0032457182bdb.tar.gz rails-8806768e9f1a2648085f7826d9a0032457182bdb.tar.bz2 rails-8806768e9f1a2648085f7826d9a0032457182bdb.zip |
Add config to disable schema dump after migration
* Add a config on Active Record named `dump_schema_after_migration`
* Schema dump doesn't happen if the config is set to false
* Set default value of the config to true
* Set config in generated production environment file to false
* Update configuration guide
* Update CHANGELOG
Diffstat (limited to 'railties/test/application/rake')
-rw-r--r-- | railties/test/application/rake/migrations_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/railties/test/application/rake/migrations_test.rb b/railties/test/application/rake/migrations_test.rb index 33c753868c..b7fd5d02c5 100644 --- a/railties/test/application/rake/migrations_test.rb +++ b/railties/test/application/rake/migrations_test.rb @@ -153,6 +153,37 @@ module ApplicationTests assert_match(/up\s+\d{3,}\s+Add email to users/, output) end end + + test 'schema generation when dump_schema_after_migration is set' do + add_to_config('config.active_record.dump_schema_after_migration = false') + + Dir.chdir(app_path) do + `rails generate model book title:string; + bundle exec rake db:migrate` + + assert !File.exist?("db/schema.rb") + end + + add_to_config('config.active_record.dump_schema_after_migration = true') + + Dir.chdir(app_path) do + `rails generate model author name:string; + bundle exec rake db:migrate` + + structure_dump = File.read("db/schema.rb") + assert_match(/create_table "authors"/, structure_dump) + end + end + + test 'default schema generation after migration' do + Dir.chdir(app_path) do + `rails generate model book title:string; + bundle exec rake db:migrate` + + structure_dump = File.read("db/schema.rb") + assert_match(/create_table "books"/, structure_dump) + end + end end end end |