]> git.ipfire.org Git - dbl.git/commitdiff
domains: Add a unique index for manually added domains
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 18:34:57 +0000 (18:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 18:34:57 +0000 (18:34 +0000)
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 <michael.tremer@ipfire.org>
src/database.sql

index eee4c161d47cd919e106f259feb33c9978221a49..fbd0c0bffb452a0fffd583b6422391abb26e948e 100644 (file)
@@ -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: -
 --