From 69d6d3ca2013e97cfd2d89449669ea7bf475f4e9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 16 Dec 2019 21:08:00 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...d_indexes_to_deployments_on_project_id_and_ref.rb | 20 ++++++++++++++++++++ db/schema.rb | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb (limited to 'db') diff --git a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb new file mode 100644 index 00000000000..5dacc3c0c66 --- /dev/null +++ b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'.freeze + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, [:project_id, :ref] + add_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME + end + + def down + remove_concurrent_index :deployments, [:project_id, :ref] + remove_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME + end +end diff --git a/db/schema.rb b/db/schema.rb index ede50e7ed06..870eb22e1f1 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_12_08_071112) do +ActiveRecord::Schema.define(version: 2019_12_14_175727) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -1357,9 +1357,11 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do t.index ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))" t.index ["project_id", "id"], name: "index_deployments_on_project_id_and_id", order: { id: :desc } t.index ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true + t.index ["project_id", "ref"], name: "index_deployments_on_project_id_and_ref" t.index ["project_id", "status", "created_at"], name: "index_deployments_on_project_id_and_status_and_created_at" t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status" t.index ["project_id", "updated_at", "id"], name: "index_deployments_on_project_id_and_updated_at_and_id", order: { updated_at: :desc, id: :desc } + t.index ["project_id"], name: "partial_index_deployments_for_project_id_and_tag", where: "(tag IS TRUE)" end create_table "description_versions", force: :cascade do |t| -- cgit v1.2.1