Commit 999cf029 authored by Valery Sizov's avatar Valery Sizov

[Issue multile assignees] Add a migration to fix inconsistent data[ci skip]

parent 2cf082ec
...@@ -25,6 +25,10 @@ class MigrateAssignees < ActiveRecord::Migration ...@@ -25,6 +25,10 @@ class MigrateAssignees < ActiveRecord::Migration
def up def up
execute <<-EOF execute <<-EOF
UPDATE issues
SET assignee_id = NULL
WHERE assignee_id NOT IN(SELECT id FROM users);
INSERT INTO issue_assignees(issue_id, user_id) INSERT INTO issue_assignees(issue_id, user_id)
SELECT id, assignee_id FROM issues WHERE assignee_id IS NOT NULL SELECT id, assignee_id FROM issues WHERE assignee_id IS NOT NULL
EOF EOF
......
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