summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-05-17 22:56:23 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-05-17 22:56:23 +0200
commitcb4ee4b1314de77554db10645c5f2f5717088f63 (patch)
tree8f470910f505f3b38afb34dcf6070fc3439cac1c
parentc75f1d3d441443a7effbeba74bdad7348432e299 (diff)
downloadgitlab-ce-cb4ee4b1314de77554db10645c5f2f5717088f63.tar.gz
Check if OLD is set when migrating issue assignees
The procedure for migrating issue assignees is invoked on both an INSERT and UPDATE. This means it will fail for INSERTs because OLD is set to NULL in this case.
-rw-r--r--db/migrate/20170516153305_migrate_assignee_to_separate_table.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
index f269ca7fc34..eed9f00d8b2 100644
--- a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
+++ b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
@@ -47,7 +47,7 @@ class MigrateAssigneeToSeparateTable < ActiveRecord::Migration
RETURNS trigger AS
$BODY$
BEGIN
- if OLD.assignee_id IS NOT NULL THEN
+ if OLD IS NOT NULL AND OLD.assignee_id IS NOT NULL THEN
DELETE FROM issue_assignees WHERE issue_id = OLD.id;
END IF;