Commit 5e24f02f authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'ab-add-index-on-environments' into 'master'

Create index on environments by state

See merge request gitlab-org/gitlab-ce!31231
parents 0a0b442f 576b397d
---
title: Create index on environments by state
merge_request: 31231
author:
type: performance
# frozen_string_literal: true
class AddIndexOnEnvironmentsWithState < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :environments, [:project_id, :state]
end
def down
remove_concurrent_index :environments, [:project_id, :state]
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_07_25_012225) do ActiveRecord::Schema.define(version: 2019_07_29_090456) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm" enable_extension "pg_trgm"
...@@ -1174,6 +1174,7 @@ ActiveRecord::Schema.define(version: 2019_07_25_012225) do ...@@ -1174,6 +1174,7 @@ ActiveRecord::Schema.define(version: 2019_07_25_012225) do
t.index ["name"], name: "index_environments_on_name_varchar_pattern_ops", opclass: :varchar_pattern_ops t.index ["name"], name: "index_environments_on_name_varchar_pattern_ops", opclass: :varchar_pattern_ops
t.index ["project_id", "name"], name: "index_environments_on_project_id_and_name", unique: true t.index ["project_id", "name"], name: "index_environments_on_project_id_and_name", unique: true
t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true
t.index ["project_id", "state"], name: "index_environments_on_project_id_and_state"
end end
create_table "epic_issues", id: :serial, force: :cascade do |t| create_table "epic_issues", id: :serial, force: :cascade do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment