blob: 1fd900002c3a636e5e51d906966099e3efd01712 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
class AddIndexToIncidentIssuesOnProjectAndCreatedAt < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
INCIDENT_TYPE = 1
OLD_INDEX_NAME = 'index_issues_project_id_issue_type_incident'
NEW_INDEX_NAME = 'index_issues_on_project_id_and_created_at_issue_type_incident'
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :issues,
[:project_id, :created_at],
where: "issue_type = #{INCIDENT_TYPE}",
name: NEW_INDEX_NAME
remove_concurrent_index_by_name :issues, OLD_INDEX_NAME
end
def down
add_concurrent_index :issues,
:project_id,
where: "issue_type = #{INCIDENT_TYPE}",
name: OLD_INDEX_NAME
remove_concurrent_index_by_name :issues, NEW_INDEX_NAME
end
end
|