aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/tasks/database_tasks.rb3
-rw-r--r--activerecord/lib/active_record/test_databases.rb12
2 files changed, 9 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb
index 521375954b..d943796024 100644
--- a/activerecord/lib/active_record/tasks/database_tasks.rb
+++ b/activerecord/lib/active_record/tasks/database_tasks.rb
@@ -248,6 +248,7 @@ module ActiveRecord
def load_schema(configuration, format = ActiveRecord::Base.schema_format, file = nil, environment = env, spec_name = "primary") # :nodoc:
file ||= dump_filename(spec_name, format)
+ verbose_was, Migration.verbose = Migration.verbose, verbose? && ENV["VERBOSE"]
check_schema_file(file)
ActiveRecord::Base.establish_connection(configuration)
@@ -261,6 +262,8 @@ module ActiveRecord
end
ActiveRecord::InternalMetadata.create_table
ActiveRecord::InternalMetadata[:environment] = environment
+ ensure
+ Migration.verbose = verbose_was
end
def schema_file(format = ActiveRecord::Base.schema_format)
diff --git a/activerecord/lib/active_record/test_databases.rb b/activerecord/lib/active_record/test_databases.rb
index 606a3b0fb5..071e8924c4 100644
--- a/activerecord/lib/active_record/test_databases.rb
+++ b/activerecord/lib/active_record/test_databases.rb
@@ -5,14 +5,14 @@ require "active_support/testing/parallelization"
module ActiveRecord
module TestDatabases # :nodoc:
ActiveSupport::Testing::Parallelization.after_fork_hook do |i|
- create_and_migrate(i, spec_name: Rails.env)
+ create_and_load_schema(i, spec_name: Rails.env)
end
- ActiveSupport::Testing::Parallelization.run_cleanup_hook do |i|
- drop(i, spec_name: Rails.env)
+ ActiveSupport::Testing::Parallelization.run_cleanup_hook do |_|
+ drop(spec_name: Rails.env)
end
- def self.create_and_migrate(i, spec_name:)
+ def self.create_and_load_schema(i, spec_name:)
old, ENV["VERBOSE"] = ENV["VERBOSE"], "false"
connection_spec = ActiveRecord::Base.configurations[spec_name]
@@ -20,13 +20,13 @@ module ActiveRecord
connection_spec["database"] += "-#{i}"
ActiveRecord::Tasks::DatabaseTasks.create(connection_spec)
ActiveRecord::Base.establish_connection(connection_spec)
- ActiveRecord::Tasks::DatabaseTasks.migrate
+ ActiveRecord::Tasks::DatabaseTasks.load_schema(connection_spec)
ensure
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env])
ENV["VERBOSE"] = old
end
- def self.drop(i, spec_name:)
+ def self.drop(spec_name:)
old, ENV["VERBOSE"] = ENV["VERBOSE"], "false"
connection_spec = ActiveRecord::Base.configurations[spec_name]