summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_in...
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
downloadgitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb')
-rw-r--r--db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb b/db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb
new file mode 100644
index 00000000000..33de4f1f790
--- /dev/null
+++ b/db/post_migrate/20200817100710_add_section_and_created_at_codeowner_approval_merge_request_index.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddSectionAndCreatedAtCodeownerApprovalMergeRequestIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ SECTION_CREATED_AT_ON_CODEOWNER_APPROVAL_MERGE_REQUEST_RULES = "index_created_at_on_codeowner_approval_merge_request_rules"
+ RULE_TYPE_CODEOWNERS = 2
+ CODEOWNER_SECTION_DEFAULT = 'codeowners'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :approval_merge_request_rules, :created_at,
+ where: "rule_type = #{RULE_TYPE_CODEOWNERS} AND section != '#{CODEOWNER_SECTION_DEFAULT}'::text",
+ name: SECTION_CREATED_AT_ON_CODEOWNER_APPROVAL_MERGE_REQUEST_RULES
+ end
+
+ def down
+ remove_concurrent_index_by_name :approval_merge_request_rules, SECTION_CREATED_AT_ON_CODEOWNER_APPROVAL_MERGE_REQUEST_RULES
+ end
+end