Commit 9face3ed authored by Toon Claes's avatar Toon Claes

Merge branch '222639-follow-up-add-author_id-index-to-audit_events' into 'master'

Add author_id index to audit_events

Closes #222639

See merge request gitlab-org/gitlab!34643
parents 2cffb220 0cc58b13
# frozen_string_literal: true
class AddAuthorIdIndexToAuditEvents < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
INDEX_NAME = 'index_audit_events_on_entity_id_entity_type_id_desc_author_id'
OLD_INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type_and_id_desc'
def up
add_concurrent_index(:audit_events, [:entity_id, :entity_type, :id, :author_id], order: { id: :desc }, name: INDEX_NAME)
remove_concurrent_index_by_name(:audit_events, OLD_INDEX_NAME)
end
def down
add_concurrent_index(:audit_events, [:entity_id, :entity_type, :id], order: { id: :desc }, name: OLD_INDEX_NAME)
remove_concurrent_index_by_name(:audit_events, INDEX_NAME)
end
end
...@@ -9419,7 +9419,7 @@ CREATE INDEX index_approvers_on_target_id_and_target_type ON public.approvers US ...@@ -9419,7 +9419,7 @@ CREATE INDEX index_approvers_on_target_id_and_target_type ON public.approvers US
CREATE INDEX index_approvers_on_user_id ON public.approvers USING btree (user_id); CREATE INDEX index_approvers_on_user_id ON public.approvers USING btree (user_id);
CREATE INDEX index_audit_events_on_entity_id_and_entity_type_and_id_desc ON public.audit_events USING btree (entity_id, entity_type, id DESC); CREATE INDEX index_audit_events_on_entity_id_entity_type_id_desc_author_id ON public.audit_events USING btree (entity_id, entity_type, id DESC, author_id);
CREATE INDEX index_audit_events_on_ruby_object_in_details ON public.audit_events USING btree (id) WHERE (details ~~ '%ruby/object%'::text); CREATE INDEX index_audit_events_on_ruby_object_in_details ON public.audit_events USING btree (id) WHERE (details ~~ '%ruby/object%'::text);
...@@ -14108,6 +14108,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -14108,6 +14108,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200615123055 20200615123055
20200615193524 20200615193524
20200615232735 20200615232735
20200616145031
20200617000757 20200617000757
20200617001001 20200617001001
20200617001118 20200617001118
......
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