Commit b84723ac authored by Valery Sizov's avatar Valery Sizov

[Issue Sorting] Improve migration

parent 56707777
......@@ -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
......
......@@ -130,7 +130,6 @@ describe Issue, 'RelativePositioning' do
expect(new_issue.relative_position).to eq(6000 + RelativePositioning::DISTANCE)
end
it 'positions issue in the middle of other two if distance is not big enough' do
issue.update relative_position: 100
issue1.update relative_position: 400
......
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