From 069b3570f5e3677bba8848c6d3845985d42c5915 Mon Sep 17 00:00:00 2001 From: Christoph Daniel Miksche Date: Thu, 1 Dec 2022 08:25:14 +0100 Subject: [PATCH] fix(database): create index only if not exists (#4798) The statements caused an error for me because the indexes were already existing. Co-authored-by: Silvan --- cmd/setup/05.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/setup/05.sql b/cmd/setup/05.sql index e3d09c6fb..743b1850b 100644 --- a/cmd/setup/05.sql +++ b/cmd/setup/05.sql @@ -1,10 +1,10 @@ -CREATE INDEX current_sequences_instance_id_idx ON adminapi.current_sequences (instance_id); -CREATE INDEX current_sequences_instance_id_idx ON auth.current_sequences (instance_id); -CREATE INDEX current_sequences_instance_id_idx ON projections.current_sequences (instance_id); +CREATE INDEX IF NOT EXISTS current_sequences_instance_id_idx ON adminapi.current_sequences (instance_id); +CREATE INDEX IF NOT EXISTS current_sequences_instance_id_idx ON auth.current_sequences (instance_id); +CREATE INDEX IF NOT EXISTS current_sequences_instance_id_idx ON projections.current_sequences (instance_id); -CREATE INDEX failed_events_instance_id_idx ON adminapi.failed_events (instance_id); -CREATE INDEX failed_events_instance_id_idx ON auth.failed_events (instance_id); -CREATE INDEX failed_events_instance_id_idx ON projections.failed_events (instance_id); +CREATE INDEX IF NOT EXISTS failed_events_instance_id_idx ON adminapi.failed_events (instance_id); +CREATE INDEX IF NOT EXISTS failed_events_instance_id_idx ON auth.failed_events (instance_id); +CREATE INDEX IF NOT EXISTS failed_events_instance_id_idx ON projections.failed_events (instance_id); ALTER TABLE adminapi.failed_events ADD COLUMN last_failed TIMESTAMPTZ; ALTER TABLE auth.failed_events ADD COLUMN last_failed TIMESTAMPTZ;