diff options
author | Xavier Noria <fxn@hashref.com> | 2014-02-06 15:03:20 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2014-02-06 15:03:20 +0100 |
commit | c0fb8d0b9c4d55770f7ce1a9cb62e4f2a75ca3ee (patch) | |
tree | 66bfa9ed07cc0ef7e82552eebac49a5b5d8838b5 /activerecord | |
parent | 7f648bc70e76b7a386a41f882ddd97105334f590 (diff) | |
parent | 8806768e9f1a2648085f7826d9a0032457182bdb (diff) | |
download | rails-c0fb8d0b9c4d55770f7ce1a9cb62e4f2a75ca3ee.tar.gz rails-c0fb8d0b9c4d55770f7ce1a9cb62e4f2a75ca3ee.tar.bz2 rails-c0fb8d0b9c4d55770f7ce1a9cb62e4f2a75ca3ee.zip |
Merge branch 'dump-schema-after-migration-flag' of git://github.com/emilsoman/rails into emilsoman-dump-schema-after-migration-flag
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/core.rb | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index e06ed5764e..1fd9003009 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,11 @@ +* Add flag to disable schema dump after migration. + + Add a config parameter on Active Record named `dump_schema_after_migration` + which is true by default. Now schema dump does not happen at the + end of migration rake task if `dump_schema_after_migration` is false. + + *Emil Soman* + * `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now return an `Enumerator` that can calculate its size. diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index d691192cfd..d9aaf8597f 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -76,6 +76,15 @@ module ActiveRecord mattr_accessor :timestamped_migrations, instance_writer: false self.timestamped_migrations = true + ## + # :singleton-method: + # Specify whether schema dump should happen at the end of the + # db:migrate rake task. This is true by default, which is useful for the + # development environment. This should ideally be false in the production + # environment where dumping schema is rarely needed. + mattr_accessor :dump_schema_after_migration, instance_writer: false + self.dump_schema_after_migration = true + # :nodoc: mattr_accessor :maintain_test_schema, instance_accessor: false diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 561387a179..9be734e88e 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -34,7 +34,7 @@ db_namespace = namespace :db do ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration| ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) end - db_namespace['_dump'].invoke + db_namespace['_dump'].invoke if ActiveRecord::Base.dump_schema_after_migration end task :_dump do |