FastAPI backend (Python 3.11, httpx for SignalR/GraphQL — no MSSQL ODBC), shares kitchen_db directly. React/TS/Vite fullscreen board frontend. Backend: auth.py (APP_SLUG=kds, SimpleNamespace), main.py (4 KDS migrations, SignalR start/stop), kds.py router, models (kds/settings/resos — read from kitchen_db), signalr_listener.py (backoff pre-existing), kds_graphql.py, database.py. Requirements stripped to ~9 packages; image ~400 MB lighter than kitchen (no MSSQL ODBC layer). Frontend: AuthGate (app=kds), single fullscreen route, dark board theme. KDS.tsx URL prefix patched (/api/kds/ → /kds/api/kds/), recipe images cross-app (/kitchen/api/recipes/). nginx: 5 blocks with SSE proxy headers on /kds/api/ block. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
973 B
Python
39 lines
973 B
Python
"""
|
|
Migration: Add KDS per-order tracking column.
|
|
|
|
Adds:
|
|
- initial_order_ids JSONB column to kds_tickets (captures order IDs at ticket creation
|
|
for detecting +ADDITION orders added later)
|
|
"""
|
|
|
|
import asyncio
|
|
import logging
|
|
from sqlalchemy import text
|
|
from database import engine
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
async def run_migration():
|
|
"""Add KDS order tracking column."""
|
|
|
|
alter_statements = [
|
|
"""
|
|
ALTER TABLE kds_tickets
|
|
ADD COLUMN IF NOT EXISTS initial_order_ids JSONB
|
|
""",
|
|
]
|
|
|
|
try:
|
|
async with engine.begin() as conn:
|
|
for sql in alter_statements:
|
|
await conn.execute(text(sql))
|
|
logger.info("Added KDS order tracking column (initial_order_ids)")
|
|
except Exception as e:
|
|
if "already exists" not in str(e).lower():
|
|
raise
|
|
logger.warning(f"KDS order tracking migration: {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(run_migration())
|