mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 21:45:25 +02:00
feat: timeline event for mealplans (#2050)
* added related user to mealplans * made timeline event message actually optional * added task to create events for mealplan recipes * replaced fk constraint ops with bulk ops * fixed event creation and adjusted query range * indentation is hard * added missing recipe id query filter * added tests
This commit is contained in:
parent
9e77a9f367
commit
5f7ac92c96
11 changed files with 371 additions and 4 deletions
|
@ -0,0 +1,43 @@
|
|||
"""add related user to mealplan
|
||||
|
||||
Revision ID: 165d943c64ee
|
||||
Revises: 167eb69066ad
|
||||
Create Date: 2023-01-21 16:54:44.368768
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
||||
import mealie.db.migration_types
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "165d943c64ee"
|
||||
down_revision = "167eb69066ad"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("group_meal_plans", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("user_id", mealie.db.migration_types.GUID(), nullable=True))
|
||||
batch_op.create_index(batch_op.f("ix_group_meal_plans_user_id"), ["user_id"], unique=False)
|
||||
batch_op.create_foreign_key("fk_user_mealplans", "users", ["user_id"], ["id"])
|
||||
|
||||
with op.batch_alter_table("shopping_list_item_recipe_reference", schema=None) as batch_op:
|
||||
batch_op.alter_column("recipe_scale", existing_type=sa.FLOAT(), nullable=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("shopping_list_item_recipe_reference", schema=None) as batch_op:
|
||||
batch_op.alter_column("recipe_scale", existing_type=sa.FLOAT(), nullable=True)
|
||||
|
||||
with op.batch_alter_table("group_meal_plans", schema=None) as batch_op:
|
||||
batch_op.drop_constraint("fk_user_mealplans", type_="foreignkey")
|
||||
batch_op.drop_index(batch_op.f("ix_group_meal_plans_user_id"))
|
||||
batch_op.drop_column("user_id")
|
||||
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue