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-12-07 03:07:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-07 03:07:51 +0300
commit4e375367b78bb44bd00957522cd9fc3e6d403fef (patch)
tree059b1ce541e4128bf03683407d7b5bbbc2094ed5 /db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
parent99ddca0d88f1e4e49d61b1aa9d41b5785528d1dc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20191204093410_add_label_project_group_partial_indexes.rb')
-rw-r--r--db/migrate/20191204093410_add_label_project_group_partial_indexes.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb b/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
new file mode 100644
index 00000000000..85666144856
--- /dev/null
+++ b/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
@@ -0,0 +1,25 @@
+# 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 AddLabelProjectGroupPartialIndexes < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ PROJECT_AND_TITLE = [:project_id, :title]
+ GROUP_AND_TITLE = [:group_id, :title]
+
+ def up
+ add_concurrent_index :labels, PROJECT_AND_TITLE, unique: false, where: "labels.group_id = null"
+ add_concurrent_index :labels, GROUP_AND_TITLE, unique: false, where: "labels.project_id = null"
+ end
+
+ def down
+ remove_concurrent_index :labels, PROJECT_AND_TITLE
+ remove_concurrent_index :labels, GROUP_AND_TITLE
+ end
+end