Commit c30983d6 authored by Robert Hunt's avatar Robert Hunt Committed by Toon Claes

Updated to remove the old index

Reverts to the old index on removal
parent f3a8bd29
......@@ -7,13 +7,16 @@ class AddAuthorIdIndexToAuditEvents < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
INDEX_NAME = 'index_on_author_id_and_entity_id_and_entity_type_and_id_desc'.freeze
INDEX_NAME = 'index_on_entity_id_and_entity_type_and_id_desc_and_author_id'.freeze
OLD_INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type_and_id_desc'.freeze
def up
add_concurrent_index(:audit_events, [:author_id, :entity_id, :entity_type, :id], order: { id: :desc }, name: INDEX_NAME)
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,8 +9419,6 @@ 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_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_ruby_object_in_details ON public.audit_events USING btree (id) WHERE (details ~~ '%ruby/object%'::text);
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON public.award_emoji USING btree (awardable_type, awardable_id);
......@@ -10469,7 +10467,7 @@ CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications
CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
CREATE INDEX index_on_author_id_and_entity_id_and_entity_type_and_id_desc ON public.audit_events USING btree (author_id, entity_id, entity_type, id DESC);
CREATE INDEX index_on_author_id_and_entity_id_and_entity_type_and_id_desc ON public.audit_events USING btree (entity_id, entity_type, id DESC, author_id);
CREATE UNIQUE INDEX index_on_deploy_keys_id_and_type_and_public ON public.keys USING btree (id, type) WHERE (public = true);
......
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