Files
xenia-pos-local/local_backend/migrations/versions/0025_order_item_source.py
T
bonaminandClaude Opus 5.5 1e8271e370 feat(waiter): where each line came from; QR lines marked, the QR message opens the table (platform-v2 step 4.8b)
- order_items.source (Alembic 0025): waiter | counter | qr | online, set by the server
  (orders.add_priced_items: the phone / manager 'waiter', the counter 'counter'; the QR
  menu's lines 'qr', online orders 'online'; a split line keeps its source); lines of
  existing online orders backfilled 'online'; in the order's item output.
- Waiter: lines the guests sent from the QR menu (or an online order) carry a "📱 QR" /
  "🌐 Online" mark; the qr_order message's banner has "Open the table", and in the bell's
  list the message opens it.
- Tests: source per channel, migration 0025, QR placement marks 'qr'; waiter e2e +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:59:57 +02:00

29 lines
961 B
Python

"""order_items.source: where a line came from (plan step 4.8): waiter | counter | qr | online.
The waiter's phone marks the lines the guests sent themselves (QR menu) and online orders.
Lines of online orders get 'online'; older lines stay NULL (unknown).
Revision ID: 0025_order_item_source
Revises: 0024_role_permissions
Create Date: 2026-11-18 10:00:00
"""
from alembic import op
import sqlalchemy as sa
revision = '0025_order_item_source'
down_revision = '0024_role_permissions'
branch_labels = None
depends_on = None
def upgrade() -> None:
with op.batch_alter_table('order_items', schema=None) as batch_op:
batch_op.add_column(sa.Column('source', sa.String(), nullable=True))
op.execute("UPDATE order_items SET source = 'online' WHERE order_id IN (SELECT id FROM orders WHERE source = 'online')")
def downgrade() -> None:
with op.batch_alter_table('order_items', schema=None) as batch_op:
batch_op.drop_column('source')