diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-12 06:08:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-12 06:08:20 +0300 |
commit | febca4e859a04ac71b1d9950de272c35875424d3 (patch) | |
tree | cabcf6ea0847a5cddbcff39880dbc0314aa47887 /scripts/decomposition | |
parent | e57da6ba898df025f93bf8d3a896c7c2ba2ab830 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/decomposition')
-rwxr-xr-x | scripts/decomposition/generate-loose-foreign-key | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/decomposition/generate-loose-foreign-key b/scripts/decomposition/generate-loose-foreign-key index fbffebb6086..66781343411 100755 --- a/scripts/decomposition/generate-loose-foreign-key +++ b/scripts/decomposition/generate-loose-foreign-key @@ -164,18 +164,20 @@ def generate_migration(definition) class Remove#{definition.to_table.camelcase}#{definition.from_table.camelcase}#{definition.column.camelcase}Fk < Gitlab::Database::Migration[2.1] disable_ddl_transaction! + FOREIGN_KEY_NAME = "#{definition.name}" + def up - return unless foreign_key_exists?(:#{definition.from_table}, :#{definition.to_table}, name: "#{definition.name}") + return unless foreign_key_exists?(:#{definition.from_table}, :#{definition.to_table}, name: FOREIGN_KEY_NAME) with_lock_retries do remove_foreign_key_if_exists(:#{definition.from_table}, :#{definition.to_table}, - name: "#{definition.name}", reverse_lock_order: true) + name: FOREIGN_KEY_NAME, reverse_lock_order: true) end end def down add_concurrent_foreign_key(:#{definition.from_table}, :#{definition.to_table}, - name: "#{definition.name}", column: :#{definition.column}, + name: FOREIGN_KEY_NAME, column: :#{definition.column}, target_column: :#{definition.primary_key}, on_delete: :#{definition.on_delete}) end end |