Scoped DB role + own theme colour (port log E17)
- Split database.py into a runtime engine (scoped `kds` DB role, used for all request handling) and a migration engine (privileged `kitchen` role, used only at startup to create KDS's own tables and ALTER kitchen_settings) — KDS previously shared kitchen's full-access DB credential wholesale - Dispose both engines on shutdown (main.py) - Fix theme colour clash: KDS was accidentally seeded with kitchen's teal (#0d9488) instead of its own colour — now #ea580c (orange), regenerated PWA icons to match Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
870027faca
commit
23889315f5
7 changed files with 4446 additions and 47 deletions
|
|
@ -5,7 +5,7 @@ from contextlib import asynccontextmanager
|
|||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from database import engine, Base
|
||||
from database import engine, runtime_engine, Base
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
|
|
@ -34,7 +34,9 @@ async def _run(name, coro):
|
|||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# Create any SQLAlchemy-mapped KDS tables (idempotent)
|
||||
# Create any SQLAlchemy-mapped KDS tables (idempotent). Uses the
|
||||
# privileged migration engine (`kitchen` role) — the scoped `kds` role
|
||||
# used for request handling can't CREATE TABLE.
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
|
||||
|
|
@ -51,6 +53,7 @@ async def lifespan(app: FastAPI):
|
|||
|
||||
await stop_signalr_listener()
|
||||
await engine.dispose()
|
||||
await runtime_engine.dispose()
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue