Commit f1e701e0 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'ab/replace-index' into 'master'

Replace index on ci_triggers

See merge request gitlab-org/gitlab!18652
parents e5539597 2cf4570d
---
title: Replace index on ci_triggers
merge_request: 18652
author:
type: performance
# frozen_string_literal: true
class ReplaceCiTriggerRequestsIndex < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
remove_concurrent_index :ci_trigger_requests, [:trigger_id]
end
def down
add_concurrent_index :ci_trigger_requests, [:trigger_id]
remove_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_10_04_133612) do
ActiveRecord::Schema.define(version: 2019_10_16_072826) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -906,7 +906,7 @@ ActiveRecord::Schema.define(version: 2019_10_04_133612) do
t.datetime "updated_at"
t.integer "commit_id"
t.index ["commit_id"], name: "index_ci_trigger_requests_on_commit_id"
t.index ["trigger_id"], name: "index_ci_trigger_requests_on_trigger_id"
t.index ["trigger_id", "id"], name: "index_ci_trigger_requests_on_trigger_id_and_id", order: { id: :desc }
end
create_table "ci_triggers", 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