Sha256: d61995dc2dd34516471c09a69d86b288bc14fdb4a0b070a828068502eff5e1c0
Contents?: true
Size: 788 Bytes
Versions: 37
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true require "active_support/testing/parallelization" module ActiveRecord module TestDatabases # :nodoc: ActiveSupport::Testing::Parallelization.after_fork_hook do |i| create_and_load_schema(i, env_name: ActiveRecord::ConnectionHandling::DEFAULT_ENV.call) end def self.create_and_load_schema(i, env_name:) old, ENV["VERBOSE"] = ENV["VERBOSE"], "false" ActiveRecord::Base.configurations.configs_for(env_name: env_name).each do |db_config| db_config._database = "#{db_config.database}-#{i}" ActiveRecord::Tasks::DatabaseTasks.reconstruct_from_schema(db_config, ActiveRecord::Base.schema_format, nil) end ensure ActiveRecord::Base.establish_connection ENV["VERBOSE"] = old end end end
Version data entries
37 entries across 37 versions & 4 rubygems