summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 15:09:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 15:09:45 +0000
commitaaf59610548d9b0fd01acfd50e831cbe519ecba2 (patch)
treeb6505abedcd965ebae5118b504b185b63129dc4c /db
parent1363ca12f1f07c634647cf55c4c16b7401098673 (diff)
downloadgitlab-ce-aaf59610548d9b0fd01acfd50e831cbe519ecba2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb18
-rw-r--r--db/schema.rb1
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb b/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb
new file mode 100644
index 00000000000..3a2390bb6a1
--- /dev/null
+++ b/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnActiveAndTemplateAndTypeAndIdToServices < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_services_on_type_and_id_and_template_when_active'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :services, [:type, :id, :template], where: 'active = TRUE', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :services, INDEX_NAME
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9edc1d9853c..db9ba2ce8f5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -3977,6 +3977,7 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.boolean "instance", default: false, null: false
t.index ["project_id", "type"], name: "index_services_on_project_id_and_type"
t.index ["template"], name: "index_services_on_template"
+ t.index ["type", "id", "template"], name: "index_services_on_type_and_id_and_template_when_active", where: "(active = true)"
t.index ["type", "instance"], name: "index_services_on_type_and_instance", unique: true, where: "(instance IS TRUE)"
t.index ["type", "template"], name: "index_services_on_type_and_template", unique: true, where: "(template IS TRUE)"
t.index ["type"], name: "index_services_on_type"