This commit is contained in:
2024-03-31 07:36:35 +03:00
parent df6e2e7fb1
commit 5de5b9b3e4
12 changed files with 1469 additions and 56 deletions

View File

@@ -12,7 +12,7 @@ class Product(BaseModel):
client_id = Column(Integer, ForeignKey('clients.id'), nullable=False, comment='ID сделки')
client = relationship('Client', back_populates='products')
barcodes = relationship('ProductBarcode', back_populates='product')
barcodes = relationship('ProductBarcode', back_populates='product', cascade="all, delete-orphan")
class ProductBarcode(BaseModel):
@@ -20,4 +20,4 @@ class ProductBarcode(BaseModel):
product_id = Column(Integer, ForeignKey('products.id'), nullable=False, comment='ID товара', primary_key=True)
product = relationship('Product', back_populates='barcodes')
barcode = Column(String, nullable=False, index=True, comment='ШК товара')
barcode = Column(String, nullable=False, index=True, comment='ШК товара', primary_key=True)