forked from anjlab/rails-data-migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ETX-221] Support Rails 7.2 - Part 2
[ETX-221] Support Rails 7.2 - Part 2
- Loading branch information
Showing
10 changed files
with
42 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module RailsDataMigrations | ||
module SharedMethods | ||
def table_name | ||
tbl_name = ENV.fetch('DATA_MIGRATIONS_TABLE_NAME', 'data_migrations') | ||
"#{ActiveRecord::Base.table_name_prefix}#{tbl_name}#{ActiveRecord::Base.table_name_suffix}" | ||
class LogEntry < ::ActiveRecord::Base | ||
def self.table_name | ||
ENV.fetch('DATA_MIGRATIONS_TABLE_NAME', 'data_migrations') | ||
end | ||
|
||
def index_name | ||
"#{table_name_prefix}#{ENV.fetch('DATA_MIGRATIONS_INDEX_NAME', 'unique_data_migrations')}#{table_name_suffix}" | ||
def self.create_table | ||
schema_migration_instance.create_table | ||
end | ||
end | ||
|
||
if Gem::Version.new('7.1.0') >= Gem::Version.new(::ActiveRecord.version) | ||
class LogEntry < ::ActiveRecord::SchemaMigration | ||
class << self | ||
include SharedMethods | ||
end | ||
end | ||
else | ||
class LogEntry < ::ActiveRecord::Base | ||
class << self | ||
include SharedMethods | ||
def create_table | ||
::ActiveRecord::SchemaMigration.define_method(:table_name) do | ||
tbl_name = ENV.fetch('DATA_MIGRATIONS_TABLE_NAME', 'data_migrations') | ||
"#{::ActiveRecord::Base.table_name_prefix}#{tbl_name}#{::ActiveRecord::Base.table_name_suffix}" | ||
end | ||
|
||
::ActiveRecord::Base.connection.schema_migration.create_table | ||
end | ||
end | ||
def self.schema_migration_instance | ||
connection_pool = ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool | ||
schema_migration = ActiveRecord::SchemaMigration.new(connection_pool) | ||
schema_migration.define_singleton_method(:table_name) { LogEntry.table_name } | ||
schema_migration.instance_variable_set(:@arel_table, Arel::Table.new(LogEntry.table_name)) | ||
schema_migration | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module RailsDataMigrations | ||
VERSION = '1.3.0.1' | ||
VERSION = '1.3.0.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters