summaryrefslogtreecommitdiff
path: root/lib/gitlab/database
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-13 13:25:11 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-18 10:51:19 +0200
commit5cd6f8c76ec74c85e6ff6dae9736b27baeb55988 (patch)
tree4606388025752bdeb9312293749124a185ef3719 /lib/gitlab/database
parent9e5c8e5d7f81b88998c8def2f4a20d54eeee49d0 (diff)
downloadgitlab-ce-5cd6f8c76ec74c85e6ff6dae9736b27baeb55988.tar.gz
Add a foreign key to `merge_requests.head_pipeline_id`
Diffstat (limited to 'lib/gitlab/database')
-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