aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/models/scan_state.py
diff options
context:
space:
mode:
Diffstat (limited to 'webmentions_ssg/models/scan_state.py')
-rw-r--r--webmentions_ssg/models/scan_state.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/webmentions_ssg/models/scan_state.py b/webmentions_ssg/models/scan_state.py
new file mode 100644
index 0000000..924c15d
--- /dev/null
+++ b/webmentions_ssg/models/scan_state.py
@@ -0,0 +1,23 @@
+# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+"""Persist the last completed source scan for this single-site service."""
+
+from datetime import datetime
+
+from sqlalchemy import DateTime, Integer
+from sqlalchemy.orm import Mapped, mapped_column
+
+from ..extensions import Base
+
+
+class ScanState(Base):
+ """The single row tracking the most recent successful source scan."""
+
+ __tablename__ = "scan_state"
+
+ id: Mapped[int] = mapped_column(Integer, primary_key=True)
+ last_completed_at: Mapped[datetime] = mapped_column(
+ DateTime(timezone=True), nullable=False
+ )