From 9db100b9eb49a587bae13f44c71ad242e493bf2e Mon Sep 17 00:00:00 2001 From: Oliver Morgan Date: Thu, 4 Jan 2024 14:37:14 +0000 Subject: [PATCH 1/2] Fix for Rails 7.x compatibility --- lib/tasks/hair_trigger.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/hair_trigger.rake b/lib/tasks/hair_trigger.rake index ccb6f60..028c075 100644 --- a/lib/tasks/hair_trigger.rake +++ b/lib/tasks/hair_trigger.rake @@ -43,7 +43,7 @@ namespace :db do # code adopted from activerecord/lib/active_record/tasks/database_tasks.rb#L441 def dump_filename(db_config_name) - format = ActiveRecord::Base.schema_format + format = ActiveRecord.respond_to?(:schema_format) ? ActiveRecord.schema_format : ActiveRecord::Base.schema_format filename = if ActiveRecord::Base.configurations.primary?(db_config_name) schema_file_type(format) else From 04219f49839ef1da41b50095271f160e47d8da8d Mon Sep 17 00:00:00 2001 From: Oliver Morgan Date: Thu, 4 Jan 2024 14:44:34 +0000 Subject: [PATCH 2/2] fixed another place --- lib/tasks/hair_trigger.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/hair_trigger.rake b/lib/tasks/hair_trigger.rake index 028c075..ba0483d 100644 --- a/lib/tasks/hair_trigger.rake +++ b/lib/tasks/hair_trigger.rake @@ -11,7 +11,8 @@ namespace :db do namespace :schema do desc "Create a db/schema.rb file that can be portably used against any DB supported by AR" task :dump => :environment do - next unless ActiveRecord::Base.schema_format == :ruby + format = ActiveRecord.respond_to?(:schema_format) ? ActiveRecord.schema_format : ActiveRecord::Base.schema_format + next unless format == :ruby require 'active_record/schema_dumper'