Sha256: a5c92dea6a0e754f89a0a4ab9624d4b63e60ec4c64b2396791bf9ee033cb11b5

Contents?: true

Size: 993 Bytes

Versions: 11

Compression:

Stored size: 993 Bytes

Contents

module DataMigrate
  class DataSchemaMigration < ActiveRecord::SchemaMigration
    # In Rails 7.1+, ActiveRecord::SchemaMigration methods are instance methods
    # So we only load the appropriate methods depending on Rails version.
    if DataMigrate::RailsHelper.rails_version_equal_to_or_higher_than_7_1
      def table_name
        ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix
      end

      def primary_key
        "version"
      end
    else
      class << self
        def table_name
          ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix
        end

        def primary_key
          "version"
        end

        def create_version(version)
          # Note that SchemaMigration.create_version in Rails 7.1 does not
          # raise an error if validations fail but we retain this behaviour for now.
          create!(version: version)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
data_migrate-11.2.0 lib/data_migrate/data_schema_migration.rb
data_migrate-11.1.0 lib/data_migrate/data_schema_migration.rb
data_migrate-11.0.0 lib/data_migrate/data_schema_migration.rb
data_migrate-11.0.0.rc3 lib/data_migrate/data_schema_migration.rb
data_migrate-11.0.0.rc lib/data_migrate/data_schema_migration.rb
data_migrate-9.4.4 lib/data_migrate/data_schema_migration.rb
data_migrate-9.4.2 lib/data_migrate/data_schema_migration.rb
data_migrate-9.4.1 lib/data_migrate/data_schema_migration.rb
data_migrate-9.4.0 lib/data_migrate/data_schema_migration.rb
data_migrate-9.3.0 lib/data_migrate/data_schema_migration.rb
data_migrate-9.2.0 lib/data_migrate/data_schema_migration.rb