diff options
author | Valery Sizov <valery@gitlab.com> | 2017-03-10 17:17:55 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-03-14 14:11:59 +0200 |
commit | b84723ac8bf8572c3d261980ab053dda52bc78dd (patch) | |
tree | 580d7ae28dd9340dd890aaa2b28178d2d1383675 /db | |
parent | 5670777735a615b511c3282e8fc79b67c74669bc (diff) | |
download | gitlab-ce-b84723ac8bf8572c3d261980ab053dda52bc78dd.tar.gz |
[Issue Sorting] Improve migration
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170309171644_reset_relative_position_for_issue.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb b/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb index ce4be131d40..b61dd7cfc61 100644 --- a/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb +++ b/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb @@ -7,10 +7,9 @@ class ResetRelativePositionForIssue < ActiveRecord::Migration DOWNTIME = false def up - execute <<-EOS - UPDATE issues SET relative_position = NULL - WHERE issues.relative_position IS NOT NULL; - EOS + update_column_in_batches(:issues, :relative_position, nil) do |table, query| + query.where(table[:relative_position].not_eq(nil)) + end end def down |