From 1e107944237f63e9cae311caf79d6f9ba0a80d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 31 Jan 2024 01:16:31 +0000 Subject: [PATCH 1/7] Add test to make sure define_attribute_methods is called on boot Only when schema cache is present and check_schema_cache_dump_version is false. --- .../application/initializers/frameworks_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index 60ce0ef62fec7..be5b610266fee 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -327,6 +327,22 @@ def show end end + test "define attribute methods when schema cache is present and check_schema_cache_dump_version is false" do + rails %w(generate model post title:string) + rails %w(db:migrate db:schema:cache:dump) + + add_to_config <<-RUBY + config.eager_load = true + config.active_record.check_schema_cache_dump_version = false + RUBY + + Dir.chdir(app_path) do + app + + assert_predicate Post, :attribute_methods_generated? + end + end + test "active record establish_connection uses Rails.env if DATABASE_URL is not set" do require "#{app_path}/config/environment" orig_database_url = ENV.delete("DATABASE_URL") From 9362dd0a3aa4e783a2f1da5d4f68b837e9dbdfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 31 Jan 2024 01:17:36 +0000 Subject: [PATCH 2/7] Use app helper to load the app This allow us to be explicit about the environment we want to load. --- .../initializers/frameworks_test.rb | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index be5b610266fee..a3e4d3c0e82eb 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -25,7 +25,7 @@ def teardown RUBY use_frameworks [] - require "#{app_path}/config/environment" + app("development") end end @@ -34,7 +34,7 @@ def teardown config.root = "#{app_path}" RUBY - require "#{app_path}/config/environment" + app("development") expanded_path = File.expand_path("app/views", app_path) assert_equal expanded_path, ActionController::Base.view_paths[0].to_s @@ -48,7 +48,7 @@ def teardown end RUBY - require "#{app_path}/config/environment" + app("development") assert_equal "test.rails", ActionMailer::Base.default_url_options[:host] end @@ -66,7 +66,7 @@ def notify end RUBY - require "#{app_path}/config/environment" + app("development") assert Foo.method_defined?(:foo_url) assert Foo.method_defined?(:main_app) end @@ -163,14 +163,14 @@ def show # AD test "action_dispatch extensions are applied to ActionDispatch" do add_to_config "config.action_dispatch.tld_length = 2" - require "#{app_path}/config/environment" + app("development") assert_equal 2, ActionDispatch::Http::URL.tld_length end test "assignment config.encoding to default_charset" do charset = "Shift_JIS" add_to_config "config.encoding = '#{charset}'" - require "#{app_path}/config/environment" + app("development") assert_equal charset, ActionDispatch::Response.default_charset end @@ -181,14 +181,14 @@ def show end RUBY - require "#{app_path}/config/environment" + app("development") assert_equal true, ActionDispatch::Http::URL.secure_protocol end # AS test "if there's no config.active_support.bare, all of ActiveSupport is required" do use_frameworks [] - require "#{app_path}/config/environment" + app("development") assert_nothing_raised { [1, 2, 3].sample } end @@ -198,7 +198,7 @@ def show use_frameworks [] Dir.chdir("#{app_path}/app") do - require "#{app_path}/config/environment" + app("development") assert_raises(NoMethodError) { "hello".exclude? "lo" } end end @@ -206,13 +206,13 @@ def show # AR test "active_record extensions are applied to ActiveRecord" do add_to_config "config.active_record.table_name_prefix = 'tbl_'" - require "#{app_path}/config/environment" + app("development") assert_equal "tbl_", ActiveRecord::Base.table_name_prefix end test "database middleware doesn't initialize when activerecord is not in frameworks" do use_frameworks [] - require "#{app_path}/config/environment" + app("development") assert !defined?(ActiveRecord::Base) || ActiveRecord.autoload?(:Base) end @@ -220,7 +220,7 @@ def show rails %w(generate model post title:string) with_unhealthy_database do - require "#{app_path}/config/environment" + app("development") end end @@ -232,7 +232,7 @@ def show config.eager_load = true RUBY - require "#{app_path}/config/environment" + app("development") assert ActiveRecord::Base.connection.schema_cache.data_sources("posts") ensure @@ -252,7 +252,7 @@ def show RUBY assert_nothing_raised do - require "#{app_path}/config/environment" + app("development") end end @@ -265,7 +265,7 @@ def show RUBY silence_warnings do - require "#{app_path}/config/environment" + app("development") end assert_not ActiveRecord::Base.connection.schema_cache.data_sources("posts") end @@ -280,7 +280,7 @@ def show with_unhealthy_database do silence_warnings do - require "#{app_path}/config/environment" + app("development") end assert_not_nil ActiveRecord::Base.connection_pool.schema_reflection.instance_variable_get(:@cache) @@ -304,7 +304,7 @@ def show config.active_record.check_schema_cache_dump_version = false RUBY - require "#{app_path}/config/environment" + app("development") assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") end @@ -318,7 +318,7 @@ def show RUBY with_unhealthy_database do - require "#{app_path}/config/environment" + app("development") assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") assert_raises ActiveRecord::ConnectionNotEstablished do @@ -344,7 +344,7 @@ def show end test "active record establish_connection uses Rails.env if DATABASE_URL is not set" do - require "#{app_path}/config/environment" + app("development") orig_database_url = ENV.delete("DATABASE_URL") orig_rails_env, Rails.env = Rails.env, "development" ActiveRecord::Base.establish_connection @@ -359,7 +359,7 @@ def show end test "active record establish_connection uses DATABASE_URL even if Rails.env is set" do - require "#{app_path}/config/environment" + app("development") orig_database_url = ENV.delete("DATABASE_URL") orig_rails_env, Rails.env = Rails.env, "development" database_url_db_name = "db/database_url_db.sqlite3" @@ -377,7 +377,7 @@ def show app_file "config/initializers/active_record.rb", <<-RUBY ActiveRecord::Base.connection RUBY - require "#{app_path}/config/environment" + app("development") assert_not_predicate ActiveRecord::Base.connection_pool, :active_connection? end @@ -399,7 +399,7 @@ def self.<(_) end RUBY - require "#{app_path}/config/environment" + app("development") assert A assert M @@ -421,7 +421,7 @@ class Post < ActiveRecord::Base end RUBY - require "#{app_path}/config/environment" + app("development") assert Post filter_parameters = Rails.application.config.filter_parameters.dup @@ -440,7 +440,7 @@ class Post < ActiveRecord::Base config.cache_store = :file_store, #{app_path("tmp/cache").inspect}, { serializer: :message_pack } RUBY - require "#{app_path}/config/environment" + app("development") post = Post.create!(title: "Hello World") Rails.cache.write("hello", post) From cac604a9927a4837ca73a6fbb8d31acb005c5dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 31 Jan 2024 01:24:10 +0000 Subject: [PATCH 3/7] Remove eager loading of schema cache dump This will be eager loaded by the define_attribute_methods initializer now that the schema cache can be automatically loaded for all connection if the file is present on disk after #48716. --- activerecord/lib/active_record/railtie.rb | 46 ++----------- .../initializers/frameworks_test.rb | 67 +++++++++---------- 2 files changed, 36 insertions(+), 77 deletions(-) diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 61b83e951fd54..21170967edfdf 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -134,49 +134,11 @@ class Railtie < Rails::Railtie # :nodoc: end end - initializer "active_record.use_schema_cache_dump" do - ActiveRecord::ConnectionAdapters::SchemaReflection.use_schema_cache_dump = config.active_record.use_schema_cache_dump - end - - initializer "active_record.check_schema_cache_dump" do - check_schema_cache_dump_version = config.active_record.check_schema_cache_dump_version - - ActiveRecord::ConnectionAdapters::SchemaReflection.check_schema_cache_dump_version = check_schema_cache_dump_version + initializer "active_record.copy_schema_cache_config" do + active_record_config = config.active_record - if config.active_record.use_schema_cache_dump && !config.active_record.lazily_load_schema_cache - config.after_initialize do |app| - ActiveSupport.on_load(:active_record) do - db_config = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first - next if db_config.nil? - - filename = ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename(db_config) - - cache = ActiveRecord::ConnectionAdapters::SchemaCache._load_from(filename) - next if cache.nil? - - if check_schema_cache_dump_version - current_version = begin - ActiveRecord::Migrator.current_version - rescue ActiveRecordError => error - warn "Failed to validate the schema cache because of #{error.class}: #{error.message}" - nil - end - - if current_version.nil? - connection_pool.schema_reflection.clear! - next - elsif cache.schema_version != current_version - warn "Ignoring #{filename} because it has expired. The current schema version is #{current_version}, but the one in the schema cache file is #{cache.schema_version}." - connection_pool.schema_reflection.clear! - next - end - end - - Rails.logger.info("Using schema cache file #{filename}") - connection_pool.schema_reflection.set_schema_cache(cache) - end - end - end + ActiveRecord::ConnectionAdapters::SchemaReflection.use_schema_cache_dump = active_record_config.use_schema_cache_dump + ActiveRecord::ConnectionAdapters::SchemaReflection.check_schema_cache_dump_version = active_record_config.check_schema_cache_dump_version end initializer "active_record.define_attribute_methods" do |app| diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index a3e4d3c0e82eb..0741a7742a6ab 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -232,30 +232,15 @@ def show config.eager_load = true RUBY - app("development") + Dir.chdir(app_path) do + app("development") - assert ActiveRecord::Base.connection.schema_cache.data_sources("posts") + assert ActiveRecord::Base.connection.schema_cache.data_sources("posts") + end ensure ActiveRecord::Base.connection.drop_table("posts", if_exists: true) # force drop posts table for test. end - test "skips checking for schema cache dump when all databases skipping database tasks" do - app_file "config/database.yml", <<-YAML - development: - database: storage/default.sqlite3 - adapter: sqlite3 - database_tasks: false - YAML - - add_to_config <<-RUBY - config.eager_load = true - RUBY - - assert_nothing_raised do - app("development") - end - end - test "expire schema cache dump" do rails %w(generate model post title:string) rails %w(db:migrate db:schema:cache:dump db:rollback) @@ -264,10 +249,15 @@ def show config.eager_load = true RUBY - silence_warnings do + Dir.chdir(app_path) do app("development") + + _, error = capture_io do + assert_not ActiveRecord::Base.connection.schema_cache.data_sources("posts") + end + + assert_match(/Ignoring db\/schema_cache\.yml because it has expired/, error) end - assert_not ActiveRecord::Base.connection.schema_cache.data_sources("posts") end test "expire schema cache dump if the version can't be checked because the database is unhealthy" do @@ -279,18 +269,20 @@ def show RUBY with_unhealthy_database do - silence_warnings do + Dir.chdir(app_path) do app("development") - end - assert_not_nil ActiveRecord::Base.connection_pool.schema_reflection.instance_variable_get(:@cache) + assert_raises ActiveRecord::ConnectionNotEstablished do + ActiveRecord::Base.connection.execute("SELECT 1") + end - assert_raises ActiveRecord::ConnectionNotEstablished do - ActiveRecord::Base.connection.execute("SELECT 1") - end + _, error = capture_io do + assert_raises ActiveRecord::ConnectionNotEstablished do + ActiveRecord::Base.connection.schema_cache.columns("posts") + end + end - assert_raises ActiveRecord::ConnectionNotEstablished do - ActiveRecord::Base.connection.schema_cache.columns("posts") + assert_match(/Failed to validate the schema cache because of ActiveRecord::ConnectionNotEstablished/, error) end end end @@ -304,8 +296,11 @@ def show config.active_record.check_schema_cache_dump_version = false RUBY - app("development") - assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") + Dir.chdir(app_path) do + app("development") + + assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") + end end test "does not expire schema cache dump if check_schema_cache_dump_version is false and the database unhealthy" do @@ -318,11 +313,13 @@ def show RUBY with_unhealthy_database do - app("development") + Dir.chdir(app_path) do + app("development") - assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") - assert_raises ActiveRecord::ConnectionNotEstablished do - ActiveRecord::Base.connection.execute("SELECT 1") + assert ActiveRecord::Base.connection_pool.schema_reflection.data_sources(:__unused__, "posts") + assert_raises ActiveRecord::ConnectionNotEstablished do + ActiveRecord::Base.connection.execute("SELECT 1") + end end end end From 67e4376a99d83ff33df92a2ecbde46ce1c7fb264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 31 Jan 2024 01:30:20 +0000 Subject: [PATCH 4/7] Remove unused methods from SchemaReflection --- .../lib/active_record/connection_adapters/schema_cache.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index e5be989117950..0ce4bd3dfcddf 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -18,10 +18,6 @@ def initialize(cache_path, cache = nil) @cache_path = cache_path end - def set_schema_cache(cache) - @cache = cache - end - def clear! @cache = empty_cache From 7e04346ec4212f0d0775cd9d4216561dda3c4b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 9 Feb 2024 20:12:53 +0000 Subject: [PATCH 5/7] Remove duplicated test This is tested in: https://github.com/rails/rails/blob/08d724a8d692c7a2e86cad9cabd6e2c9a8b3d6a1/railties/test/application/initializers/frameworks_test.rb#L263 --- railties/test/application/rake/dbs_test.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index cfbd1990a46d6..30cf17b028e4b 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -510,22 +510,6 @@ def db_schema_cache_dump end end - test "db:schema:cache:dump ignores validation errors" do - Dir.chdir(app_path) do - rails "generate", "model", "book", "title:string" - rails "db:migrate" - rails "db:schema:cache:dump" - - ActiveRecord::Migrator.stub(:current_version, -> { raise ActiveRecord::ActiveRecordError, "stubbed error" }) do - validation_warning = capture(:stderr) do - cache_tables = rails("runner", "p ActiveRecord::Base.connection.schema_cache.columns('books')", stderr: true).strip - assert_includes cache_tables, "title", "expected cache_tables to include a title entry" - end - assert_match(/Failed to validate the schema cache because of ActiveRecord::ActiveRecordError: stubbed error/, validation_warning) - end - end - end - def db_fixtures_load(expected_database) Dir.chdir(app_path) do rails "generate", "model", "book", "title:string" From 83f4441901f745ead984199cc50dabf797b38005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 9 Feb 2024 20:24:56 +0000 Subject: [PATCH 6/7] Fix deprecation message The message was partially duplicated because `deprecation_warning` was being called instead of `warn` --- activerecord/lib/active_record/tasks/database_tasks.rb | 2 +- activerecord/test/cases/tasks/database_tasks_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index 12bd72a63fdb1..efd154abab2ca 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -444,7 +444,7 @@ def cache_dump_filename(db_config_or_name, schema_cache_path: nil) ENV["SCHEMA_CACHE"] || db_config_or_name.default_schema_cache_path(ActiveRecord::Tasks::DatabaseTasks.db_dir) else - ActiveRecord.deprecator.deprecation_warning(<<~MSG.squish) + ActiveRecord.deprecator.warn(<<~MSG.squish) Passing a database name to `cache_dump_filename` is deprecated and will be removed in Rails 7.3. Pass a `ActiveRecord::DatabaseConfigurations::DatabaseConfig` object instead. MSG diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index 24f67334e31ae..70cb0b1e86e7b 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -400,7 +400,7 @@ def test_deprecated_cache_dump_filename_with_env_override ENV["SCHEMA_CACHE"] = "tmp/something.yml" ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "db") do - path = assert_deprecated(ActiveRecord.deprecator) do + path = assert_deprecated(/Passing a database name to `cache_dump_filename` is deprecated and will be removed in Rails 7\.3\. Pass a `ActiveRecord::DatabaseConfigurations::DatabaseConfig` object instead\. \(/, ActiveRecord.deprecator) do ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename("primary") end assert_equal "tmp/something.yml", path From f91cb4f81fb6c64e3edebfbeca992c3506fc399c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 9 Feb 2024 20:28:34 +0000 Subject: [PATCH 7/7] Deprecated `ENV["SCHEMA_CACHE"]` in favor of `schema_cache_path` in the databse configuration The config in the yaml allows for more complex configuration. --- activerecord/CHANGELOG.md | 4 ++++ .../lib/active_record/tasks/database_tasks.rb | 15 +++++++++++++-- .../test/cases/tasks/database_tasks_test.rb | 8 +++++--- railties/test/application/rake/dbs_test.rb | 11 ----------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 4ae5bfc2d42e6..8b37f79f077b7 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Deprecated `ENV["SCHEMA_CACHE"]` in favor of `schema_cache_path` in the database configuration. + + *Rafael Mendonça França* + * Add `ActiveRecord::Base.with_connection` as a shortcut for leasing a connection for a short duration. The leased connection is yielded, and for the duration of the block, any call to `ActiveRecord::Base.connection` diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index efd154abab2ca..1dc08990d1e3d 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -441,7 +441,7 @@ def cache_dump_filename(db_config_or_name, schema_cache_path: nil) if db_config_or_name.is_a?(DatabaseConfigurations::DatabaseConfig) schema_cache_path || db_config_or_name.schema_cache_path || - ENV["SCHEMA_CACHE"] || + schema_cache_env || db_config_or_name.default_schema_cache_path(ActiveRecord::Tasks::DatabaseTasks.db_dir) else ActiveRecord.deprecator.warn(<<~MSG.squish) @@ -455,7 +455,7 @@ def cache_dump_filename(db_config_or_name, schema_cache_path: nil) "#{db_config_or_name}_schema_cache.yml" end - schema_cache_path || ENV["SCHEMA_CACHE"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, filename) + schema_cache_path || schema_cache_env || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, filename) end end @@ -523,6 +523,17 @@ def migration_connection # :nodoc: end private + def schema_cache_env + if ENV["SCHEMA_CACHE"] + ActiveRecord.deprecator.warn(<<~MSG.squish) + Setting `ENV["SCHEMA_CACHE"]` is deprecated and will be removed in Rails 7.3. + Configure the `:schema_cache_path` in the database configuration instead. + MSG + + nil + end + end + def with_temporary_pool(db_config, clobber: false) original_db_config = migration_class.connection_db_config pool = migration_class.connection_handler.establish_connection(db_config, clobber: clobber) diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index 70cb0b1e86e7b..d05dd08a447e8 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -388,8 +388,10 @@ def test_cache_dump_filename_with_env_override config = DatabaseConfigurations::HashConfig.new("development", "primary", {}) ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "db") do - path = ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename(config) - assert_equal "tmp/something.yml", path + path = assert_deprecated(/Setting `ENV\["SCHEMA_CACHE"\]` is deprecated and will be removed in Rails 7\.3\. Configure the `:schema_cache_path` in the database configuration instead\. \(/, ActiveRecord.deprecator) do + ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename(config) + end + assert_equal "db/schema_cache.yml", path end ensure ENV["SCHEMA_CACHE"] = old_path @@ -403,7 +405,7 @@ def test_deprecated_cache_dump_filename_with_env_override path = assert_deprecated(/Passing a database name to `cache_dump_filename` is deprecated and will be removed in Rails 7\.3\. Pass a `ActiveRecord::DatabaseConfigurations::DatabaseConfig` object instead\. \(/, ActiveRecord.deprecator) do ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename("primary") end - assert_equal "tmp/something.yml", path + assert_equal "db/schema_cache.yml", path end ensure ENV["SCHEMA_CACHE"] = old_path diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 30cf17b028e4b..4b24d186a3326 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -439,17 +439,6 @@ def db_schema_cache_dump db_schema_cache_dump end - test "db:schema:cache:dump custom env" do - @old_schema_cache_env = ENV["SCHEMA_CACHE"] - filename = "db/special_schema_cache.yml" - ENV["SCHEMA_CACHE"] = filename - - db_schema_dump - db_schema_cache_dump - ensure - ENV["SCHEMA_CACHE"] = @old_schema_cache_env - end - test "db:schema:cache:dump first config wins" do Dir.chdir(app_path) do File.open("#{app_path}/config/database.yml", "w") do |f|