The database URL is read automatically from backend.config.settings (your .env),
so commands need no extra flags. Run from the project root.
# Apply all migrations (creates the schema on a fresh DB)
alembic upgrade head
# Autogenerate a migration after changing models in backend/database/models.py
alembic revision --autogenerate -m "add widget table"
# Roll back one revision
alembic downgrade -1
# Show current revision
alembic current- Baseline (
0001_initial) builds the whole schema from the SQLAlchemy models usingcreate_all(idempotent) and enables thepgvectorextension on PostgreSQL. - The app also calls
create_allon startup for dev convenience. Because both are idempotent they coexist. For a strict migration-driven prod flow, runalembic upgrade headagainst a fresh DB; if the app already created the tables, runalembic stamp headonce to mark them as migrated. - pgvector requires PostgreSQL — migrations targeting SQLite will skip the extension
and the
document_chunksvector table.