2019-02-11 12:48:37 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
# rubocop:disable Style/Documentation
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module BackgroundMigration
|
2019-02-14 08:48:20 -05:00
|
|
|
class SyncIssuesStateId
|
|
|
|
def perform(start_id, end_id)
|
2019-03-01 14:24:47 -05:00
|
|
|
ActiveRecord::Base.connection.execute <<~SQL
|
|
|
|
UPDATE issues
|
|
|
|
SET state_id =
|
|
|
|
CASE state
|
|
|
|
WHEN 'opened' THEN 1
|
|
|
|
WHEN 'closed' THEN 2
|
|
|
|
END
|
|
|
|
WHERE state_id IS NULL
|
|
|
|
AND id BETWEEN #{start_id} AND #{end_id}
|
|
|
|
SQL
|
2019-02-11 12:48:37 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|