Skip to content

Commit 9f0b137

Browse files
[ETX-221] Support Rails 7.2
1 parent d967d74 commit 9f0b137

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Appraisals

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ruby_version = Gem::Version.new(RUBY_VERSION)
44

5-
if ruby_version >= Gem::Version.new('3.2.0')
5+
if ruby_version >= Gem::Version.new('3.1.0')
66
appraise 'rails-7.2' do
77
gem 'rails', '~> 7.2.0'
88
gem 'sqlite3', '~> 1.4.0'

lib/rails_data_migrations/log_entry.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ def self.table_name
77
end
88

99
def self.create_table
10-
schema_migration = ::ActiveRecord::Base.connection_pool.schema_migration
10+
connection_pool = ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool
11+
schema_migration = ActiveRecord::SchemaMigration.new(connection_pool)
1112
schema_migration.define_singleton_method(:table_name) { ::RailsDataMigrations::LogEntry.table_name }
1213
schema_migration.create_table
1314
end

lib/rails_data_migrations/migrator.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ def list_pending_migrations
4343
end
4444

4545
def run_migration(direction, version)
46-
schema_migration = ::ActiveRecord::Base.connection_pool.schema_migration
46+
connection_pool = ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool
47+
schema_migration = ActiveRecord::SchemaMigration.new(connection_pool)
4748
schema_migration.define_singleton_method(:table_name) { ::RailsDataMigrations::LogEntry.table_name }
48-
internal_metadata = ::ActiveRecord::Base.connection_pool.internal_metadata
49+
internal_metadata = ActiveRecord::InternalMetadata.new(connection_pool)
4950
new(direction, list_migrations, schema_migration, internal_metadata, version).run
5051
end
5152
end

0 commit comments

Comments
 (0)