summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/migration_helpers.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-24 00:08:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-24 00:08:48 +0000
commit312d3ac2598495b455130247a1bea915cd5fc466 (patch)
tree2b048f0fe68ca75e38ced65e6b7c022b7586a9d2 /lib/gitlab/database/migration_helpers.rb
parent00ab3a60fed93cb3c6c9148d9c9c68fb11d325ee (diff)
downloadgitlab-ce-312d3ac2598495b455130247a1bea915cd5fc466.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/database/migration_helpers.rb')
-rw-r--r--lib/gitlab/database/migration_helpers.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index c1f4b8d5e25..91199c55b1d 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -316,6 +316,13 @@ module Gitlab
end
end
+ # Since we may be migrating in one go from a previous version without
+ # `constrained_table_name` then we may see that this column exists
+ # (as above) but the schema cache is still outdated for the model.
+ unless Gitlab::Database::PostgresForeignKey.column_names.include?('constrained_table_name')
+ Gitlab::Database::PostgresForeignKey.reset_column_information
+ end
+
fks = Gitlab::Database::PostgresForeignKey.by_constrained_table_name_or_identifier(source)
fks = fks.by_referenced_table_name(target) if target