Ensure ne_collection_job.trigger_mode exists on existing DBs.

Missing column broke ops task overview and collection queries when Alembic skipped legacy DDL; add always-on safety net plus migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-12 16:58:52 +08:00
parent 3f18702edc
commit 329ae8501f
3 changed files with 59 additions and 1 deletions

View file

@ -10,6 +10,7 @@ from .db import Base, SessionLocal, engine
from .schema_patches import (
apply_all_legacy_startup_ddl,
apply_auth_schema_patches,
apply_collection_schema_safety_net,
apply_topology_schema_safety_net,
run_alembic_upgrade_to_head,
)
@ -58,8 +59,9 @@ def run_api_startup() -> None:
# Critical topology columns even when full legacy DDL is skipped
# (e.g. alembic stamped head without applying domain patches).
apply_topology_schema_safety_net(conn)
apply_collection_schema_safety_net(conn)
except Exception:
_log.exception("startup: auth/topology schema safety patches failed")
_log.exception("startup: auth/topology/collection schema safety patches failed")
if skip_ddl and alembic_ok:
_log.info("startup: schema via Alembic (legacy inline DDL skipped)")
else: