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:
authorThong Kuah <tkuah@gitlab.com>2019-08-19 16:17:28 +0300
committerThong Kuah <tkuah@gitlab.com>2019-08-29 03:37:15 +0300
commit1dec74808cca3d78c904f645659384b525c72337 (patch)
treebff482016e6a3aebe8300f6105c9229d0e3ec6bc /db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb
parentb34120336d33e57d9817559f82771f8da4f5f2b3 (diff)
Add index to improve query performance
For Environment.deployed_to_cluster
Diffstat (limited to 'db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb')
-rw-r--r--db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb b/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb
new file mode 100644
index 00000000000..bfa91e33558
--- /dev/null
+++ b/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddClusterStatusIndexToDeployments < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deployments, [:cluster_id, :status]
+ end
+
+ def down
+ remove_concurrent_index :deployments, [:cluster_id, :status]
+ end
+end