Skip to content
Snippets Groups Projects
Commit 12ea6ff0 authored by Mayra Cabrera's avatar Mayra Cabrera :zero:
Browse files

Merge branch 'fix-failing-issues-index-post-migration' into 'master'

Fix the failing post migration when index exists

See merge request !91082
parents 1054c540 e5685a6f
No related branches found
No related tags found
1 merge request!91082Fix the failing post migration when index exists
Pipeline #574187397 failed
......@@ -9,11 +9,16 @@ class AddIndexesIssuesOnProjectIdAndClosedAt < Gitlab::Database::Migration[2.0]
def up
# Index to improve performance when sorting issues by closed_at desc
add_concurrent_index :issues, 'project_id, closed_at DESC NULLS LAST, state_id, id', name: NEW_INDEX_NAME_1
unless index_exists_by_name?(:issues, NEW_INDEX_NAME_1)
add_concurrent_index :issues, 'project_id, closed_at DESC NULLS LAST, state_id, id', name: NEW_INDEX_NAME_1
end
# Index to improve performance when sorting issues by closed_at asc
# This replaces the old index which didn't account for state_id and id
add_concurrent_index :issues, [:project_id, :closed_at, :state_id, :id], name: NEW_INDEX_NAME_2
unless index_exists_by_name?(:issues, NEW_INDEX_NAME_2)
add_concurrent_index :issues, [:project_id, :closed_at, :state_id, :id], name: NEW_INDEX_NAME_2
end
remove_concurrent_index_by_name :issues, OLD_INDEX_NAME
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment