Backend: table groups with prefix/color, auto-numbering, has_active_order flag
TableGroup gains prefix and color columns for display in the PWA zone filter. Table creation now assigns a global auto-increment number; batch creation uses group-local label numbering (avoids gaps/conflicts when adding to existing groups). DELETE table now blocks if an active order exists (soft or hard delete). Hard delete cascades past orders before removing the table row. list_tables enriches each TableOut with has_active_order computed server-side. TableOut no longer requires number in the input payload; TableCreate simplified. Migration runner refactored to give each ALTER TABLE its own connection so a no-op (column already exists) doesn't leave a dirty transaction blocking later migrations. New migrations added for all new columns. Order.print_logs relationship gains cascade="all, delete-orphan" so print logs are removed when an order is deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ class Order(Base):
|
||||
closer = relationship("User", foreign_keys=[closed_by], back_populates="orders_closed")
|
||||
items = relationship("OrderItem", back_populates="order", cascade="all, delete-orphan")
|
||||
waiters = relationship("OrderWaiter", back_populates="order", cascade="all, delete-orphan")
|
||||
print_logs = relationship("PrintLog", back_populates="order")
|
||||
print_logs = relationship("PrintLog", back_populates="order", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class OrderWaiter(Base):
|
||||
|
||||
Reference in New Issue
Block a user