summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-07-18 13:09:25 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-07-18 13:09:25 +0000
commit11f9ac0a48b62cef25eedede4c1819964f08d5ce (patch)
treed1e9c3c7e73cf4db3d27b8207a6533f6ac61adb8 /lib
parent178aaa739a2e9a9f6ecc216b41279488a4867497 (diff)
parent2deeac56438a5056444563596433b7bb448160fe (diff)
downloadgitlab-ce-11f9ac0a48b62cef25eedede4c1819964f08d5ce.tar.gz
Merge branch 'backstage/gb/add-index-and-foreign-key-to-merge-requests' into 'master'
Add a foreign key to `merge_requests.head_pipeline_id` Closes #34065 See merge request !12837
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/database/migration_helpers.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 0643c56db9b..69ca9aa596b 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -140,6 +140,8 @@ module Gitlab
return add_foreign_key(source, target,
column: column,
on_delete: on_delete)
+ else
+ on_delete = 'SET NULL' if on_delete == :nullify
end
disable_statement_timeout
@@ -155,7 +157,7 @@ module Gitlab
ADD CONSTRAINT #{key_name}
FOREIGN KEY (#{column})
REFERENCES #{target} (id)
- #{on_delete ? "ON DELETE #{on_delete}" : ''}
+ #{on_delete ? "ON DELETE #{on_delete.upcase}" : ''}
NOT VALID;
EOF