summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb')
-rw-r--r--db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb b/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb
new file mode 100644
index 00000000000..65ec43930ea
--- /dev/null
+++ b/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddUpvotesCountIndexToIssues < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_project_id_and_upvotes_count'
+
+ def up
+ add_concurrent_index :issues, [:project_id, :upvotes_count], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :issues, [:project_id, :upvotes_count], name: INDEX_NAME
+ end
+end