Commit a2c8fbb6 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch '336901-fix-spec-migrationhelpers-to-properly-support-many-databases' into 'master'

Resolve "Fix spec \`MigrationHelpers\` to properly support many databases" \[RUN AS-IF-FOSS\]

See merge request gitlab-org/gitlab!70063
parents fcd31f67 3bdf92cb
......@@ -2,7 +2,7 @@
module MigrationsHelpers
def active_record_base
ActiveRecord::Base
Gitlab::Database.database_base_models.fetch(self.class.metadata[:database] || :main)
end
def table(name)
......@@ -34,7 +34,7 @@ module MigrationsHelpers
end
def migrations_paths
ActiveRecord::Migrator.migrations_paths
active_record_base.connection.migrations_paths
end
def migration_context
......@@ -52,7 +52,7 @@ module MigrationsHelpers
end
def foreign_key_exists?(source, target = nil, column: nil)
ActiveRecord::Base.connection.foreign_keys(source).any? do |key|
active_record_base.connection.foreign_keys(source).any? do |key|
if column
key.options[:column].to_s == column.to_s
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment