Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 15:06:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 15:06:26 +0300
commitd2798d607e11e0ebae83ae909404834388733428 (patch)
tree096b7f4d4bdb315d28cdcd4d6db4e80911112e9c /db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb
parentd8211a0ed119eada7d292e974a8fc7b0cd982d3c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb')
-rw-r--r--db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb b/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb
new file mode 100644
index 00000000000..e8f5b853d1d
--- /dev/null
+++ b/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddAnyApproverRuleUniqueIndexes < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ PROJECT_RULE_UNIQUE_INDEX = 'any_approver_project_rule_type_unique_index'
+ MERGE_REQUEST_RULE_UNIQUE_INDEX = 'any_approver_merge_request_rule_type_unique_index'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:approval_project_rules, [:project_id],
+ where: "rule_type = 3",
+ name: PROJECT_RULE_UNIQUE_INDEX, unique: true)
+
+ add_concurrent_index(:approval_merge_request_rules, [:merge_request_id, :rule_type],
+ where: "rule_type = 4",
+ name: MERGE_REQUEST_RULE_UNIQUE_INDEX, unique: true)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:approval_project_rules, PROJECT_RULE_UNIQUE_INDEX)
+ remove_concurrent_index_by_name(:approval_merge_request_rules, MERGE_REQUEST_RULE_UNIQUE_INDEX)
+ end
+end