summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-18 09:22:43 -0700
committerStan Hu <stanhu@gmail.com>2015-09-21 12:05:01 -0700
commit24a0e86dd3bb682802784af3b011a00f43104c13 (patch)
treee73038588ac9ecf6d17bdafe0a8b0a8cd8214a18 /db/migrate
parentabaa65efc1f912ffef05ccaf1e92dc009f828278 (diff)
downloadgitlab-ce-24a0e86dd3bb682802784af3b011a00f43104c13.tar.gz
Remove deleted milestones from merge requests
Closes https://github.com/gitlabhq/gitlabhq/issues/9643
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb
new file mode 100644
index 00000000000..0aad6fe5e6e
--- /dev/null
+++ b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb
@@ -0,0 +1,5 @@
+class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration
+ def up
+ execute("UPDATE merge_requests SET milestone_id = NULL where milestone_id NOT IN (SELECT id FROM milestones)")
+ end
+end