数据:增加测试批次模型与迁移契约

This commit is contained in:
焦龙言
2026-09-22 14:37:31 +08:00
parent 40c56c6b33
commit 17bfa2c5fe
12 changed files with 1278 additions and 32 deletions
@@ -27,6 +27,13 @@ class BizStrain(Base):
)
strain_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='菌种ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
strain_code = Column(String(64), nullable=False, unique=True, comment='菌种编码')
strain_name = Column(String(100), nullable=False, comment='菌种名称')
status = Column(CHAR(1), nullable=False, server_default='0', comment='状态(0正常 1停用)')
@@ -52,6 +59,13 @@ class BizWarehouse(Base):
)
warehouse_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='仓库ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
warehouse_code = Column(String(64), nullable=False, unique=True, comment='仓库编码')
warehouse_name = Column(String(100), nullable=False, comment='仓库名称')
address = Column(String(500), nullable=True, comment='仓库地址')
@@ -78,6 +92,13 @@ class BizCustomer(Base):
)
customer_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='客户ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
customer_code = Column(String(64), nullable=False, unique=True, comment='客户编码')
customer_name = Column(String(100), nullable=False, comment='客户名称')
status = Column(CHAR(1), nullable=False, server_default='0', comment='状态(0正常 1停用)')
@@ -104,6 +125,13 @@ class BizCustomerSite(Base):
)
site_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='现场ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
customer_id = Column(
BigInteger,
ForeignKey('biz_customer.customer_id'),
@@ -137,6 +165,13 @@ class BizProductionLine(Base):
)
line_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='产线ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
site_id = Column(
BigInteger,
ForeignKey('biz_customer_site.site_id'),
@@ -169,6 +204,13 @@ class BizPallet(Base):
)
pallet_id = Column(BigInteger, primary_key=True, nullable=False, autoincrement=True, comment='托盘ID')
test_batch_id = Column(
BigInteger,
ForeignKey('biz_test_batch.batch_id'),
nullable=True,
index=True,
comment='测试数据批次ID;NULL表示正式数据',
)
pallet_code = Column(String(64), nullable=False, unique=True, comment='托盘编号')
qr_token = Column(String(128), nullable=False, unique=True, comment='二维码固定标识')
capacity_packages = Column(Integer, nullable=False, comment='容量包数')