Class: Gitlab::BackgroundMigration::SyncIssuesStateId

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/sync_issues_state_id.rb

Instance Method Summary collapse

Instance Method Details

#perform(start_id, end_id) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/background_migration/sync_issues_state_id.rb', line 7

def perform(start_id, end_id)
  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
end