From 948e537ca4b1b98371a910a740c4954f8a2e7e07 Mon Sep 17 00:00:00 2001 From: bnaecker Date: Tue, 26 Jul 2022 12:40:10 -0700 Subject: [PATCH] Make a few more database indexes unique (#1499) --- common/src/sql/dbinit.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/sql/dbinit.sql b/common/src/sql/dbinit.sql index c6576d78f6..b86c8c790f 100644 --- a/common/src/sql/dbinit.sql +++ b/common/src/sql/dbinit.sql @@ -686,7 +686,7 @@ CREATE TABLE omicron.public.metric_producer ( oximeter_id UUID NOT NULL ); -CREATE INDEX ON omicron.public.metric_producer ( +CREATE UNIQUE INDEX ON omicron.public.metric_producer ( oximeter_id, id ); @@ -1135,8 +1135,9 @@ CREATE UNIQUE INDEX ON omicron.public.instance_external_ip ( ) WHERE time_deleted IS NULL; -CREATE INDEX ON omicron.public.instance_external_ip ( - instance_id +CREATE UNIQUE INDEX ON omicron.public.instance_external_ip ( + instance_id, + id ) WHERE instance_id IS NOT NULL AND time_deleted IS NULL;