Commit 12e77890 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'test-update_column_in_batches-with-sql-mysql' into 'master'

Make sure that Arel.sql would work for update_column_in_batches

See merge request !11610
parents 35ab669a b3095251
...@@ -247,6 +247,14 @@ describe Gitlab::Database::MigrationHelpers, lib: true do ...@@ -247,6 +247,14 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
expect(Project.where(archived: true).count).to eq(1) expect(Project.where(archived: true).count).to eq(1)
end end
end end
context 'when the value is Arel.sql (Arel::Nodes::SqlLiteral)' do
it 'updates the value as a SQL expression' do
model.update_column_in_batches(:projects, :star_count, Arel.sql('1+1'))
expect(Project.sum(:star_count)).to eq(2 * Project.count)
end
end
end end
describe '#add_column_with_default' do describe '#add_column_with_default' do
......
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