diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-18 14:11:00 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-18 15:07:16 -0800 |
commit | 9611a410be296a2ef2e8ae7df69830dce293199b (patch) | |
tree | 58ddddae00855bf9b58cb262f9ab719e2d8c3ff2 | |
parent | f7a9ced235be7ef13f90b561d23ffe602e11e9a3 (diff) | |
download | gitlab-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.rb | 1 |
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 |