diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-12-29 11:05:04 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2014-01-02 13:49:00 +0000 |
commit | ff7ab3bc78abc3e8439a57ef7d755c5aa5b069f4 (patch) | |
tree | 5ad6aed8ee454c320967d767229debde268da2e2 /activerecord/lib/active_record/railtie.rb | |
parent | a1d0c0fa3d8ca97edc8f2a1d6ba96af19221dbad (diff) | |
download | rails-ff7ab3bc78abc3e8439a57ef7d755c5aa5b069f4.tar.gz rails-ff7ab3bc78abc3e8439a57ef7d755c5aa5b069f4.tar.bz2 rails-ff7ab3bc78abc3e8439a57ef7d755c5aa5b069f4.zip |
Automatically maintain test database schema
* Move check from generated helper to test_help.rb, so that all
applications can benefit
* Rather than just raising when the test schema has pending migrations,
try to load in the schema and only raise if there are pending
migrations afterwards
* Opt out of the check by setting
config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
for maintaining the test schema, so we don't need rake tasks for this.
This is also a speed improvement since we're no longer reloading the
test database on every call to "rake test".
Diffstat (limited to 'activerecord/lib/active_record/railtie.rb')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 2a8cd83285..ec85b3c843 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -31,22 +31,15 @@ module ActiveRecord config.active_record.use_schema_cache_dump = true + config.active_record.maintain_test_schema = true config.eager_load_namespaces << ActiveRecord rake_tasks do require "active_record/base" - ActiveRecord::Tasks::DatabaseTasks.seed_loader = Rails.application - ActiveRecord::Tasks::DatabaseTasks.env = Rails.env - namespace :db do task :load_config do - ActiveRecord::Tasks::DatabaseTasks.db_dir = Rails.application.config.paths["db"].first - ActiveRecord::Tasks::DatabaseTasks.migrations_paths = Rails.application.paths['db/migrate'].to_a - ActiveRecord::Tasks::DatabaseTasks.fixtures_path = File.join Rails.root, 'test', 'fixtures' - ActiveRecord::Tasks::DatabaseTasks.root = Rails.root - configuration = if ENV["DATABASE_URL"] { Rails.env => ENV["DATABASE_URL"] } else |