Sha256: ae33f9d3f6f86676a43df5e14aa5954c0c00e347967ce85f18ccbe8822d1289b

Contents?: true

Size: 782 Bytes

Versions: 77

Compression:

Stored size: 782 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.schema_format, nil)
      end
    ensure
      ActiveRecord::Base.establish_connection
      ENV["VERBOSE"] = old
    end
  end
end

Version data entries

77 entries across 74 versions & 7 rubygems

Version Path
activerecord-7.2.1 lib/active_record/test_databases.rb
activerecord-7.2.0 lib/active_record/test_databases.rb
activerecord-7.2.0.rc1 lib/active_record/test_databases.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/test_databases.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/test_databases.rb
activerecord-7.2.0.beta3 lib/active_record/test_databases.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/test_databases.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/test_databases.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/test_databases.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/test_databases.rb
activerecord-7.2.0.beta2 lib/active_record/test_databases.rb
activerecord-7.1.3.4 lib/active_record/test_databases.rb
activerecord-7.0.8.4 lib/active_record/test_databases.rb
activerecord-7.2.0.beta1 lib/active_record/test_databases.rb
activerecord-7.1.3.2 lib/active_record/test_databases.rb
activerecord-7.1.3.1 lib/active_record/test_databases.rb
activerecord-7.0.8.1 lib/active_record/test_databases.rb
activerecord-7.1.3 lib/active_record/test_databases.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.2.3/lib/active_record/test_databases.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/active_record/test_databases.rb