]> git.ipfire.org Git - dbl.git/commitdiff
db: Don't export deleted lists/sources to DNS
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Dec 2025 14:14:40 +0000 (14:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Dec 2025 14:14:40 +0000 (14:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.sql

index 35b5ec03ccddf9e449a0a501e12add97b2fcda83..172f5632b742035f2560ee987a6b580486a52aff 100644 (file)
@@ -2,7 +2,7 @@
 -- PostgreSQL database dump
 --
 
-\restrict EcVPjzzaAxJjnzRDIpbc5yv5dhcWfScauYVZ8LFOgEDGgDejiH1MIE95SYJrtnU
+\restrict ebDe037JaAShmh4Wj0bqo8KtmN1x40U4LDPgEduqxMDJPp7ElBRvkok5c3Cwr5B
 
 -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1)
 -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1)
@@ -81,7 +81,8 @@ CREATE VIEW public.domains AS
     ''::text AS account,
     ''::text AS options,
     ''::text AS catalog
-   FROM public.lists;
+   FROM public.lists
+  WHERE (deleted_at IS NULL);
 
 
 --
@@ -185,18 +186,20 @@ CREATE VIEW public.records AS
             ''::text AS ordername,
             true AS auth
            FROM public.lists
+          WHERE (lists.deleted_at IS NULL)
         UNION ALL
          SELECT lists.id,
             (lists.slug || '.dnsbl.ipfire.org'::text),
-            'NS'::text,
+            'NS'::text AS text,
             (nameservers.name || '.'::text),
             nameservers.ttl,
             0,
             false,
-            ''::text,
+            ''::text AS text,
             true
            FROM public.lists,
             public.nameservers
+          WHERE (lists.deleted_at IS NULL)
         UNION ALL
          SELECT lists.id AS domain_id,
             (((source_domains.name || '.'::text) || lists.slug) || '.dnsbl.ipfire.org'::text) AS name,
@@ -210,7 +213,7 @@ CREATE VIEW public.records AS
            FROM ((public.source_domains
              LEFT JOIN public.sources ON ((source_domains.source_id = sources.id)))
              LEFT JOIN public.lists ON ((sources.list_id = lists.id)))
-          WHERE (source_domains.removed_at IS NULL)
+          WHERE ((lists.deleted_at IS NULL) AND (sources.deleted_at IS NULL) AND (source_domains.removed_at IS NULL))
         )
  SELECT row_number() OVER (ORDER BY name) AS id,
     domain_id,
@@ -373,5 +376,5 @@ ALTER TABLE ONLY public.sources
 -- PostgreSQL database dump complete
 --
 
-\unrestrict EcVPjzzaAxJjnzRDIpbc5yv5dhcWfScauYVZ8LFOgEDGgDejiH1MIE95SYJrtnU
+\unrestrict ebDe037JaAShmh4Wj0bqo8KtmN1x40U4LDPgEduqxMDJPp7ElBRvkok5c3Cwr5B