BigW Consortium Gitlab

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.
parent c75f1d3d
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment