summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-12-18 14:11:00 -0800
committerStan Hu <stanhu@gmail.com>2017-12-18 15:07:16 -0800
commit9611a410be296a2ef2e8ae7df69830dce293199b (patch)
tree58ddddae00855bf9b58cb262f9ab719e2d8c3ff2
parentf7a9ced235be7ef13f90b561d23ffe602e11e9a3 (diff)
downloadgitlab-ce-9611a410be296a2ef2e8ae7df69830dce293199b.tar.gz
Fix missing WHERE clause in 20171106135924_issues_milestone_id_foreign_key migration
If milestone_id is NULL, we shouldn't need to update it to be NULL again. This was causing us to touch almost all rows in the issues table for no good reason. Closes https://gitlab.com/gitlab-com/infrastructure/issues/3416
-rw-r--r--db/migrate/20171106135924_issues_milestone_id_foreign_key.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb b/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
index e6a780d0964..bfb3dcae511 100644
--- a/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
+++ b/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
@@ -16,6 +16,7 @@ class IssuesMilestoneIdForeignKey < ActiveRecord::Migration
def self.with_orphaned_milestones
where('NOT EXISTS (SELECT true FROM milestones WHERE milestones.id = issues.milestone_id)')
+ .where('milestone_id IS NOT NULL')
end
end