From: Michael Tremer Date: Tue, 30 Dec 2025 18:34:57 +0000 (+0000) Subject: domains: Add a unique index for manually added domains X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d21ef0c0df4a663e5b97db97681fd6b769a64b56;p=dbl.git domains: Add a unique index for manually added domains We don't want to have any duplicates, but we will have to accept any duplicates that we are receiving from other sources. Signed-off-by: Michael Tremer --- diff --git a/src/database.sql b/src/database.sql index eee4c16..fbd0c0b 100644 --- a/src/database.sql +++ b/src/database.sql @@ -358,6 +358,13 @@ CREATE INDEX domains_search ON public.domains USING btree (name) WHERE (removed_ CREATE UNIQUE INDEX domains_sources ON public.domains USING btree (source_id, name) WHERE (removed_at IS NULL); +-- +-- Name: domains_unique; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX domains_unique ON public.domains USING btree (list_id, name) WHERE ((source_id IS NULL) AND (removed_at IS NULL)); + + -- -- Name: domains_updated_at; Type: INDEX; Schema: public; Owner: - --