feat: phase 2 content model + cache — SQLite schema, markdown, TTL
Stand up the full SQLite content layer: all 7 tables from the authoritative schema with WAL + foreign-keys enforced per-connection, entity dataclasses plus row mappers, hand-rolled versioned migrations tracked in schema_migrations, and an idempotent Python seed (system user + welcome post + About page). Add a Markdown->HTML service using markdown-it-py with a strict bleach allowlist (tables intentionally omitted on both sides). Add a typed in-process TTLCache[K,V] and wire it into real DB-backed PostService and PageService, both exposing invalidate_all() for Phase 4 admin writes. Rewire / and /about to read from the DB; homepage renders the seeded welcome post, About renders page.title + sanitized body_html_cached. Update the Phase 1 route tests accordingly. Mark Phase 2 complete in docs/ROADMAP.md.
This commit is contained in:
12
app/models/migrations/__init__.py
Normal file
12
app/models/migrations/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""SQL migration files applied by :mod:`app.db` at startup.
|
||||
|
||||
This package holds the authoritative schema history for the
|
||||
``chicken_babies_site`` database. Each ``.sql`` file is applied exactly
|
||||
once in lexicographic order; the runner tracks which files have been
|
||||
applied in a ``schema_migrations`` table.
|
||||
|
||||
No Python code lives here — the files are trusted, developer-authored
|
||||
SQL loaded via ``sqlite3.Connection.executescript`` at boot.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
Reference in New Issue
Block a user