summaryrefslogtreecommitdiff
path: root/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20181101144347_add_index_for_stuck_mr_query.rb')
-rw-r--r--db/migrate/20181101144347_add_index_for_stuck_mr_query.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb b/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
new file mode 100644
index 00000000000..5d3ace54e5c
--- /dev/null
+++ b/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+class AddIndexForStuckMrQuery < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, [:id, :merge_jid], where: "merge_jid IS NOT NULL and state = 'locked'"
+ end
+
+ def down
+ remove_concurrent_index :merge_requests, [:id, :merge_jid], where: "merge_jid IS NOT NULL and state = 'locked'"
+ end
+end