]> git.ipfire.org Git - dbl.git/commitdiff
lists: Initialize updated_at with the current timestamp
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Dec 2025 12:16:00 +0000 (12:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Dec 2025 12:16:00 +0000 (12:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.sql
src/dnsbl/exporters.py
src/dnsbl/lists.py

index f75331c7fa5fe5f59d4a5c982aa5af78d0897a44..489861599f334414493cf1ce86031c15cae98156 100644 (file)
@@ -2,7 +2,7 @@
 -- PostgreSQL database dump
 --
 
-\restrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f
+\restrict 6nJVr9P5tK3JEHqsf1GqOxn2ArIH0TeeAQGlXEqO2KxOZaX0g6qxzMEPFvsyQVJ
 
 -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1)
 -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1)
@@ -36,7 +36,7 @@ CREATE TABLE public.lists (
     deleted_at timestamp with time zone,
     deleted_by text,
     license text NOT NULL,
-    updated_at timestamp with time zone,
+    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
     description text
 );
 
@@ -274,5 +274,5 @@ ALTER TABLE ONLY public.sources
 -- PostgreSQL database dump complete
 --
 
-\unrestrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f
+\unrestrict 6nJVr9P5tK3JEHqsf1GqOxn2ArIH0TeeAQGlXEqO2KxOZaX0g6qxzMEPFvsyQVJ
 
index 4ff304cbbe496df382a0efb3612ceefab7d6b967..28a2339a914a0a82c1493378c0484ff9abaa0eb7 100644 (file)
@@ -92,18 +92,9 @@ class TextExporter(Exporter):
                                "",
                        ]
 
-               # Add the license
                lines += [
                        " License : %s" % self.list.license,
-               ]
-
-               # Add the update timestamp
-               if self.list.updated_at:
-                       lines += [
-                               " Updated : %s" % self.list.updated_at.isoformat(),
-                       ]
-
-               lines += [
+                       " Updated : %s" % self.list.updated_at.isoformat(),
                        "",
                        " Copyright (C) %s - IPFire Team" % now.strftime("%Y"),
                        "",
@@ -169,10 +160,7 @@ class ZoneExporter(TextExporter):
                zone = dns.zone.Zone(origin)
 
                # Make the serial
-               if self.list.updated_at:
-                       serial = self.list.updated_at.strftime("%s")
-               else:
-                       serial = "0"
+               serial = self.list.updated_at.strftime("%s")
 
                # Create the SOA
                soa = dns.rdataset.from_text(
index efcd96e0db7dafed2902cb6ec9f4872e2d5b9f4a..7c2e814618c3cb085ed21f1c04726c76692cec76 100644 (file)
@@ -172,7 +172,7 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True):
                self.updated_at = sqlmodel.func.current_timestamp()
 
        # Updated At
-       updated_at : datetime.datetime | None
+       updated_at : datetime.datetime
 
        @functools.cached_property
        def zone(self):