Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Rails 7.x compatibility #118

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/tasks/hair_trigger.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down