Skip to content

Commit

Permalink
Fix for Rails 7.x compatibility (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
ollym authored Jan 4, 2024
1 parent 1d6be97 commit 75ae832
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tasks/hair_trigger.rake
Original file line number Diff line number Diff line change
@@ -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'

@@ -43,7 +44,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

0 comments on commit 75ae832

Please sign in to comment.