This commit is contained in:
2026-06-23 09:38:31 +08:00
parent f6d8829071
commit 6b3188e693
11 changed files with 197 additions and 47 deletions
+4 -1
View File
@@ -660,7 +660,10 @@ class Warehouse(Base):
class Inventory(Base):
"""库存表"""
__tablename__ = "inventory"
__table_args__ = (
UniqueConstraint("product_id", "warehouse_id", name="uq_inventory_product_warehouse"),
)
id = Column(Integer, primary_key=True, index=True)
product_id = Column(Integer, ForeignKey("products.id"), nullable=False, index=True)
warehouse_id = Column(Integer, ForeignKey("warehouses.id"), nullable=False, index=True)