16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/debci/db.rb', line 16
def self.migrate(target_version = nil)
migrations_path = File.join(File.dirname(__FILE__), 'db', 'migrations')
ActiveRecord::Migration.verbose = !Debci.config.quiet
if ActiveRecord.version.release >= Gem::Version.new('7.0')
pool = ActiveRecord::Base.connection_pool
migrations = ActiveRecord::MigrationContext.new(migrations_path).migrations
ActiveRecord::Migrator.new(:up, migrations, pool.schema_migration, pool.internal_metadata).migrate
elsif ActiveRecord.version.release >= Gem::Version.new('6.0')
ActiveRecord::MigrationContext.new(migrations_path, ActiveRecord::SchemaMigration).migrate(target_version)
else
ActiveRecord::MigrationContext.new(migrations_path).migrate(target_version)
end
end
|