fix(db): bootstrap the panel-access schema (users.username, user_panels, user_project_members, projects planning columns)

The pm branch's model expects these but nothing created them — login 500s
with UndefinedColumnError users.username on any volume that predates the
RBAC work, including fresh ones (migration.sql never had the column
either). The pm author evidently altered his local DB by hand.

ensure_rbac_schema() now creates all of it idempotently at startup,
alongside the audit/bot_drafts/project_transfers ensures.
This commit is contained in:
MMD
2026-10-01 16:45:37 +03:30
parent ea6a377023
commit 4b84844b54
2 changed files with 46 additions and 0 deletions
+2
View File
@@ -32,6 +32,7 @@ from app.db.init_db import (
ensure_dashboard_tables,
ensure_material_topic_column,
ensure_quote_projects,
ensure_rbac_schema,
ensure_project_transfers_table,
ensure_v26,
)
@@ -107,6 +108,7 @@ async def lifespan(_app: FastAPI):
await ensure_material_topic_column(engine)
await ensure_quote_projects(engine)
await ensure_v26(engine)
await ensure_rbac_schema(engine)
await ensure_audit_table(engine)
await ensure_drop_category_tables(engine)
await ensure_bot_drafts_table(engine)