from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey from sqlalchemy.sql import text from database import Base class ProductPackaging(Base): __tablename__ = "product_packaging" id = Column(Integer, primary_key=True, index=True, comment='主键 ID') product_number = Column(String(11), nullable=False, server_default="", index=True, comment='产品货号') model = Column(String(50), nullable=False, server_default="", comment='型号') length = Column(Float, nullable=False, server_default="0", comment='长度 (cm)') width = Column(Float, nullable=False, server_default="0", comment='宽度 (cm)') height = Column(Float, nullable=False, server_default="0", comment='高度 (cm)') volume = Column(Float, nullable=False, server_default="0", comment='体积 (cm³)') weight = Column(Float, nullable=False, server_default="0", comment='重量 (g)') company_code = Column(String(50), nullable=False, server_default="", index=True, comment='公司编码,用于数据隔离') created_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间') updated_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='更新时间')