From fc77fc7991264c7e6690b4ee06b0791fac3c3856 Mon Sep 17 00:00:00 2001 From: "Davis W. Frank" Date: Mon, 5 Feb 2024 14:44:10 -0800 Subject: [PATCH 1/2] Adds option to YAML load of database.yml so that Psych doesn't complain. --- lib/test_data/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_data/config.rb b/lib/test_data/config.rb index f335549..65f4fa2 100644 --- a/lib/test_data/config.rb +++ b/lib/test_data/config.rb @@ -97,7 +97,7 @@ def after_rails_fixture_load(callable = nil, &blk) end def database_yaml - YAMLLoader.load_file(database_yaml_full_path) + YAMLLoader.load_file(database_yaml_full_path, aliases: true) end def database_name From c5e76726daf9a0a822ad78a78a3056aa7b379c40 Mon Sep 17 00:00:00 2001 From: "Davis W. Frank" Date: Mon, 5 Feb 2024 15:19:50 -0800 Subject: [PATCH 2/2] Attempts to fix #9 by explicitly creating a new instance of InternalMetadata --- lib/test_data/determines_databases_associated_dump_time.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/test_data/determines_databases_associated_dump_time.rb b/lib/test_data/determines_databases_associated_dump_time.rb index 394ccc5..812e8f4 100644 --- a/lib/test_data/determines_databases_associated_dump_time.rb +++ b/lib/test_data/determines_databases_associated_dump_time.rb @@ -1,7 +1,8 @@ module TestData class DeterminesDatabasesAssociatedDumpTime def call - if (last_dumped_at = ActiveRecord::InternalMetadata.find_by(key: "test_data:last_dumped_at")&.value) + internal_metadata = ActiveRecord::InternalMetadata.new(ActiveRecord::Base.connection) + if (last_dumped_at = internal_metadata["test_data:last_dumped_at"]) Time.parse(last_dumped_at) end rescue ActiveRecord::StatementInvalid