from datetime import datetime from sqlalchemy import DateTime from sqlalchemy.orm import DeclarativeBase class Base(DeclarativeBase): # Every timestamp in this schema is timestamptz UTC (docs/PLAN.md's convention) — without # this, a bare `Mapped[datetime]` infers a naive TIMESTAMP column, which then silently # disagrees with a migration that (correctly) declares DateTime(timezone=True), and asyncpg # rejects the mismatch at insert time. Setting it once here means every current and future # model gets it right by default instead of each column needing to repeat it. type_annotation_map = { datetime: DateTime(timezone=True), }