The lifespan hook calls init_db() on every boot:
from app.db.engine import init_db
init_db()
logger.info("Database initialized/verified on startup")
backend/app/main.py:30
and init_db is metadata.create_all (backend/app/db/engine.py:93), whose own docstring says "In production, use Alembic migrations instead" (backend/app/db/engine.py:80).
create_all is create-if-missing only. It never alters an existing table.
Trigger: add a nullable column to CodeJob, restart the server against an existing app.db.
Observed: startup logs "Database tables created/verified", the app boots green, and the first SELECT that touches the new column fails at request time with no such column. get_migration_status (backend/app/db/engine.py:109) cannot detect this either — it only checks that alembic_version has a row.
Expected: either run alembic upgrade head at startup, or keep create_all strictly behind a FAROS_DEV_AUTOCREATE=1 flag and let a missing table be a loud failure.
The initialized_no_migrations status value at backend/app/db/engine.py:155 shows this ambiguity was already anticipated; it should be treated as an error state rather than a reported-and-ignored one.
The lifespan hook calls
init_db()on every boot:backend/app/main.py:30and
init_dbismetadata.create_all(backend/app/db/engine.py:93), whose own docstring says "In production, use Alembic migrations instead" (backend/app/db/engine.py:80).create_allis create-if-missing only. It never alters an existing table.Trigger: add a nullable column to
CodeJob, restart the server against an existingapp.db.Observed: startup logs "Database tables created/verified", the app boots green, and the first
SELECTthat touches the new column fails at request time withno such column.get_migration_status(backend/app/db/engine.py:109) cannot detect this either — it only checks thatalembic_versionhas a row.Expected: either run
alembic upgrade headat startup, or keepcreate_allstrictly behind aFAROS_DEV_AUTOCREATE=1flag and let a missing table be a loud failure.The
initialized_no_migrationsstatus value atbackend/app/db/engine.py:155shows this ambiguity was already anticipated; it should be treated as an error state rather than a reported-and-ignored one.