summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-08-20 01:17:28 +1200
committerThong Kuah <tkuah@gitlab.com>2019-08-29 12:37:15 +1200
commit1dec74808cca3d78c904f645659384b525c72337 (patch)
treebff482016e6a3aebe8300f6105c9229d0e3ec6bc /db/migrate
parentb34120336d33e57d9817559f82771f8da4f5f2b3 (diff)
downloadgitlab-ce-1dec74808cca3d78c904f645659384b525c72337.tar.gz
Add index to improve query performance
For Environment.deployed_to_cluster
Diffstat (limited to 'db/migrate')
-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