59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
from sqlalchemy import Column, Float, ForeignKey, Integer, String
|
|
|
|
from app import db
|
|
from app.models.base import default_uuid
|
|
|
|
|
|
class LabRationCalcTotal(db.Model):
|
|
__tablename__ = "lab_ration_calc_total"
|
|
|
|
id = Column(String(36), primary_key=True, default=default_uuid)
|
|
recipe_id = Column(
|
|
String(36),
|
|
ForeignKey("lab_recipe_ration.recipe_id"),
|
|
nullable=False,
|
|
index=True,
|
|
)
|
|
scope = Column(String(16), nullable=False, default="ration")
|
|
metric_key = Column(String(32), nullable=False)
|
|
label = Column(String(128), nullable=False, default="")
|
|
value = Column(Float, nullable=True)
|
|
sort_order = Column(Integer, nullable=False, default=0)
|
|
|
|
|
|
class LabRationCalcIndicator(db.Model):
|
|
__tablename__ = "lab_ration_calc_indicator"
|
|
|
|
id = Column(String(36), primary_key=True, default=default_uuid)
|
|
recipe_id = Column(
|
|
String(36),
|
|
ForeignKey("lab_recipe_ration.recipe_id"),
|
|
nullable=False,
|
|
index=True,
|
|
)
|
|
scope = Column(String(16), nullable=False, default="ration")
|
|
indicator_key = Column(String(64), nullable=True)
|
|
label = Column(String(128), nullable=False, default="")
|
|
unit = Column(String(32), nullable=False, default="")
|
|
min_value = Column(Float, nullable=True)
|
|
max_value = Column(Float, nullable=True)
|
|
content = Column(Float, nullable=True)
|
|
diff = Column(Float, nullable=True)
|
|
sort_order = Column(Integer, nullable=False, default=0)
|
|
|
|
|
|
class LabRationCompoundLine(db.Model):
|
|
__tablename__ = "lab_ration_compound_line"
|
|
|
|
id = Column(String(36), primary_key=True, default=default_uuid)
|
|
recipe_id = Column(
|
|
String(36),
|
|
ForeignKey("lab_recipe_ration.recipe_id"),
|
|
nullable=False,
|
|
index=True,
|
|
)
|
|
row_index = Column(Integer, nullable=False, default=0)
|
|
ingredient_name = Column(String(200), nullable=True)
|
|
daily_kg = Column(Float, nullable=True)
|
|
share_pct = Column(Float, nullable=True)
|