Commit eba3d8d5 authored by Patrick Bair's avatar Patrick Bair

Merge branch 'sy-add-shift-timeframe-index' into 'master'

Add index on starts_at/ends_at for oncall shifts

See merge request gitlab-org/gitlab!52961
parents 06adfa5c 90ba60f0
---
title: Add index to incident management oncall shifts table
merge_request: 52961
author:
type: performance
# frozen_string_literal: true
class AddIndexToOncallShftsOnStartsAtAndEndsAt < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
NEW_NAME = 'index_oncall_shifts_on_rotation_id_and_starts_at_and_ends_at'
OLD_NAME = 'index_incident_management_oncall_shifts_on_rotation_id'
def up
add_concurrent_index :incident_management_oncall_shifts, %i[rotation_id starts_at ends_at], name: NEW_NAME
remove_concurrent_index_by_name :incident_management_oncall_shifts, OLD_NAME
end
def down
add_concurrent_index :incident_management_oncall_shifts, :rotation_id, name: OLD_NAME
remove_concurrent_index_by_name :incident_management_oncall_shifts, NEW_NAME
end
end
6cb54c71a9835ec1b3cf801a19c2cd385d224e0438c7924b6a29d298ecebe8a7
\ No newline at end of file
......@@ -22130,8 +22130,6 @@ CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON inciden
CREATE INDEX index_incident_management_oncall_shifts_on_participant_id ON incident_management_oncall_shifts USING btree (participant_id);
CREATE INDEX index_incident_management_oncall_shifts_on_rotation_id ON incident_management_oncall_shifts USING btree (rotation_id);
CREATE UNIQUE INDEX index_index_statuses_on_project_id ON index_statuses USING btree (project_id);
CREATE INDEX index_insights_on_namespace_id ON insights USING btree (namespace_id);
......@@ -22578,6 +22576,8 @@ CREATE INDEX index_onboarding_progresses_for_verify_track ON onboarding_progress
CREATE UNIQUE INDEX index_onboarding_progresses_on_namespace_id ON onboarding_progresses USING btree (namespace_id);
CREATE INDEX index_oncall_shifts_on_rotation_id_and_starts_at_and_ends_at ON incident_management_oncall_shifts USING btree (rotation_id, starts_at, ends_at);
CREATE INDEX index_open_project_tracker_data_on_service_id ON open_project_tracker_data USING btree (service_id);
CREATE INDEX index_operations_feature_flags_issues_on_issue_id ON operations_feature_flags_issues USING btree (issue_id);
......
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