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-27 10:50:18 +1200
commitd38a1557e6e102ce121033eeabdef8710ab3c628 (patch)
tree1aac8466f75e7aa34fe246422771fd5d6b48d997
parent0eb145198ff2d101a20e80cdf47e809b77e2c3c6 (diff)
downloadgitlab-ce-cluster_deployments.tar.gz
Remove redundant indexcluster_deployments
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.rb3
2 files changed, 19 insertions, 2 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 d13c8c450ff..4607b1a99af 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_08_20_163320) do
+ActiveRecord::Schema.define(version: 2019_08_26_090628) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -1144,7 +1144,6 @@ ActiveRecord::Schema.define(version: 2019_08_20_163320) 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"