mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-24 08:43:11 -05:00
add unit standardization fields
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
"""add unit standardization fields
|
||||||
|
|
||||||
|
Revision ID: a39c7f1826e3
|
||||||
|
Revises: 1d9a002d7234
|
||||||
|
Create Date: 2026-02-21 17:59:01.161812
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "a39c7f1826e3"
|
||||||
|
down_revision: str | None = "1d9a002d7234"
|
||||||
|
branch_labels: str | tuple[str, ...] | None = None
|
||||||
|
depends_on: str | tuple[str, ...] | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table("ingredient_units", schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column("standard_quantity", sa.Float(), nullable=True))
|
||||||
|
batch_op.add_column(sa.Column("standard_unit", sa.String(), nullable=True))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table("ingredient_units", schema=None) as batch_op:
|
||||||
|
batch_op.drop_column("standard_unit")
|
||||||
|
batch_op.drop_column("standard_quantity")
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -52,6 +52,10 @@ class IngredientUnitModel(SqlAlchemyBase, BaseMixins):
|
|||||||
cascade="all, delete, delete-orphan",
|
cascade="all, delete, delete-orphan",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Standardization
|
||||||
|
standard_quantity: Mapped[float | None] = mapped_column(Float)
|
||||||
|
standard_unit: Mapped[str | None] = mapped_column(String)
|
||||||
|
|
||||||
# Automatically updated by sqlalchemy event, do not write to this manually
|
# Automatically updated by sqlalchemy event, do not write to this manually
|
||||||
name_normalized: Mapped[str | None] = mapped_column(sa.String, index=True)
|
name_normalized: Mapped[str | None] = mapped_column(sa.String, index=True)
|
||||||
plural_name_normalized: Mapped[str | None] = mapped_column(sa.String, index=True)
|
plural_name_normalized: Mapped[str | None] = mapped_column(sa.String, index=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user