diff options
| author | Dennis Fink | 2026-11-18 08:01:26 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-18 08:01:26 +0100 |
| commit | b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a (patch) | |
| tree | 322d85654e5518c2836ce57beafaa7e2abaab741 /webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py | |
| parent | 63af533d98aac82b6d4f069b217d3e837285508d (diff) | |
| download | webmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.tar.gz webmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.zip | |
feat(core): add dashboard overview
Replace the root redirect with an authenticated dashboard showing
received and outgoing status counts, recent activity, pending sends,
retries, and queue depth.
Persist the last completed source scan so operational status survives
restarts and only advances after a successful, conclusive scan.
Diffstat (limited to 'webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py')
| -rw-r--r-- | webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py b/webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py new file mode 100644 index 0000000..168647f --- /dev/null +++ b/webmentions_ssg/migrations/versions/2b4c6e8a0d12_last_completed_source_scan.py @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Track the last successful source scan. + +Revision ID: 2b4c6e8a0d12 +Revises: ef8a9b6c2d41 +""" + +import sqlalchemy as sa +from alembic import op + +revision = "2b4c6e8a0d12" +down_revision = "ef8a9b6c2d41" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "scan_state", + sa.Column("id", sa.Integer(), primary_key=True), + sa.Column("last_completed_at", sa.DateTime(timezone=True), nullable=False), + ) + # Seed a best-effort historical completion time from previously scanned + # sources. The next completed scan will update the authoritative value. + op.execute( + sa.text( + "INSERT INTO scan_state (id, last_completed_at) " + "SELECT 1, MAX(last_seen_at) FROM source_documents " + "HAVING COUNT(*) > 0" + ) + ) + + +def downgrade(): + op.drop_table("scan_state") |
