blob: cad5c74bb8a3273ebe8a93cb0bb4964d7048a807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
class BackfillCurrentValueWithProgressWorkItemProgresses < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
each_batch('work_item_progresses', connection: connection) do |relation|
min, max = relation.pick('MIN(issue_id), MAX(issue_id)')
execute(<<~SQL)
UPDATE work_item_progresses SET current_value = progress
WHERE issue_id BETWEEN #{min} AND #{max}
SQL
end
end
def down
# no-op as the columns are newly added
end
end
|