summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-11-07 18:53:02 +0900
committerShinya Maeda <shinya@gitlab.com>2018-11-07 18:53:02 +0900
commit66d43c84810838cf496134a05fde8dfcc5c8246f (patch)
treece07b368582c7201b34d2b257a65df292c1c405d /db
parent97ac2d72353ced89051f49161a6e669f7fc16572 (diff)
downloadgitlab-ce-66d43c84810838cf496134a05fde8dfcc5c8246f.tar.gz
Add index on created_at with status
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20181106135939_add_index_to_deployments.rb2
-rw-r--r--db/schema.rb1
2 files changed, 3 insertions, 0 deletions
diff --git a/db/migrate/20181106135939_add_index_to_deployments.rb b/db/migrate/20181106135939_add_index_to_deployments.rb
index 0b840999de3..dc9a053d21c 100644
--- a/db/migrate/20181106135939_add_index_to_deployments.rb
+++ b/db/migrate/20181106135939_add_index_to_deployments.rb
@@ -10,6 +10,7 @@ class AddIndexToDeployments < ActiveRecord::Migration
def up
add_concurrent_index :deployments, [:project_id, :status, :id]
add_concurrent_index :deployments, [:project_id, :status, :iid]
+ add_concurrent_index :deployments, [:project_id, :status, :created_at]
add_concurrent_index :deployments, [:environment_id, :status, :id]
add_concurrent_index :deployments, [:environment_id, :status, :iid]
add_concurrent_index :deployments, [:environment_id, :sha]
@@ -18,6 +19,7 @@ class AddIndexToDeployments < ActiveRecord::Migration
def down
remove_concurrent_index :deployments, [:project_id, :status, :id]
remove_concurrent_index :deployments, [:project_id, :status, :iid]
+ remove_concurrent_index :deployments, [:project_id, :status, :created_at]
remove_concurrent_index :deployments, [:environment_id, :status, :id]
remove_concurrent_index :deployments, [:environment_id, :status, :iid]
remove_concurrent_index :deployments, [:environment_id, :sha]
diff --git a/db/schema.rb b/db/schema.rb
index bbd52af36af..cb46083cea0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -839,6 +839,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do
add_index "deployments", ["environment_id", "status"], name: "index_deployments_on_environment_id_and_status", using: :btree
add_index "deployments", ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))", using: :btree
add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree
+ add_index "deployments", ["project_id", "status", "created_at"], name: "index_deployments_on_project_id_and_status_and_created_at", using: :btree
add_index "deployments", ["project_id", "status", "id"], name: "index_deployments_on_project_id_and_status_and_id", using: :btree
add_index "deployments", ["project_id", "status", "iid"], name: "index_deployments_on_project_id_and_status_and_iid", using: :btree
add_index "deployments", ["project_id", "status"], name: "index_deployments_on_project_id_and_status", using: :btree