summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-08-26 21:11:41 +1200
committerThong Kuah <tkuah@gitlab.com>2019-08-29 12:37:36 +1200
commit3ed555f3c980ef7c21efd17cabc06a8037643787 (patch)
treefd07f390269a38ad420f376c02308f573399d7a9
parent1dec74808cca3d78c904f645659384b525c72337 (diff)
downloadgitlab-ce-3ed555f3c980ef7c21efd17cabc06a8037643787.tar.gz
Remove redundant index
Now we have cluster_id, state index, we don't the cluster_id index as well.
-rw-r--r--db/migrate/20190826090628_remove_redundant_deployments_index.rb18
-rw-r--r--db/schema.rb1
2 files changed, 18 insertions, 1 deletions
diff --git a/db/migrate/20190826090628_remove_redundant_deployments_index.rb b/db/migrate/20190826090628_remove_redundant_deployments_index.rb
new file mode 100644
index 00000000000..6b009c17d64
--- /dev/null
+++ b/db/migrate/20190826090628_remove_redundant_deployments_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveRedundantDeploymentsIndex < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :deployments, :cluster_id
+ end
+
+ def down
+ add_concurrent_index :deployments, :cluster_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 14029486dfe..54774b0a65b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1147,7 +1147,6 @@ ActiveRecord::Schema.define(version: 2019_08_28_083843) do
t.datetime_with_timezone "finished_at"
t.integer "cluster_id"
t.index ["cluster_id", "status"], name: "index_deployments_on_cluster_id_and_status"
- t.index ["cluster_id"], name: "index_deployments_on_cluster_id"
t.index ["created_at"], name: "index_deployments_on_created_at"
t.index ["deployable_type", "deployable_id"], name: "index_deployments_on_deployable_type_and_deployable_id"
t.index ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id"