From 858d175c1527d650ea5d83e201777d0cf8ae84c9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 9 Mar 2023 17:30:09 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-9-stable-ee --- lib/gitlab/database/migration_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 9c1cb8e352c..9b041c18da4 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -367,12 +367,12 @@ module Gitlab def foreign_key_exists?(source, target = nil, **options) # This if block is necessary because foreign_key_exists? is called in down migrations that may execute before - # the postgres_foreign_keys view had necessary columns added, or even before the view existed. + # the postgres_foreign_keys view had necessary columns added. # In that case, we revert to the previous behavior of this method. # The behavior in the if block has a bug: it always returns false if the fk being checked has multiple columns. # This can be removed after init_schema.rb passes 20221122210711_add_columns_to_postgres_foreign_keys.rb # Tracking issue: https://gitlab.com/gitlab-org/gitlab/-/issues/386796 - if ActiveRecord::Migrator.current_version < 20221122210711 + unless connection.column_exists?('postgres_foreign_keys', 'constrained_table_name') return foreign_keys(source).any? do |foreign_key| tables_match?(target.to_s, foreign_key.to_table.to_s) && options_match?(foreign_key.options, options) -- cgit v1.2.3