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:
@@ -8,7 +8,9 @@ class TableGroup(Base):
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, nullable=False, unique=True)
|
||||
prefix = Column(String, nullable=True)
|
||||
sort_order = Column(Integer, default=0)
|
||||
color = Column(String, nullable=True)
|
||||
|
||||
tables = relationship("Table", back_populates="group")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user