diff options
Diffstat (limited to 'db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb')
-rw-r--r-- | db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb b/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb new file mode 100644 index 00000000000..cfc37c55121 --- /dev/null +++ b/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToIssueMetrics < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_issue_metrics_first_mentioned_in_commit' + + def up + add_concurrent_index :issue_metrics, :issue_id, where: 'EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :issue_metrics, name: INDEX_NAME + end +end |