Skip to main content
The tracker uses PostgreSQL through SQLModel, with Alembic for migrations.

Add a table

Declare the model with table=True:
Import it in session.py so SQLModel sees it:

Generate and apply a migration

From services/tracker/:
This runs alembic revision --autogenerate and writes a file to src/tracker/database/migrations/versions/. Apply it with:
Migration tests run through pytest-alembic on every push and pull request:

Known defect: a custom type is not imported

Alembic sometimes generates a migration that refers to a custom type by its module path without importing it, which fails on upgrade:
Import the type at the top of the generated migration:
Then use the short name in the column:
Run uv run alembic upgrade head afterwards.