Coverage for opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2024-04-07-01.05.20_7788478a0338_add_group_recipe_actions.py: 74%

19 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-11-25 17:29 +0000

1"""add group recipe actions 

2 

3Revision ID: 7788478a0338 

4Revises: d7c6efd2de42 

5Create Date: 2024-04-07 01:05:20.816270 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10from alembic import op 1a

11 

12import mealie.db.migration_types 1a

13 

14# revision identifiers, used by Alembic. 

15revision = "7788478a0338" 1a

16down_revision = "d7c6efd2de42" 1a

17branch_labels: str | tuple[str, ...] | None = None 1a

18depends_on: str | tuple[str, ...] | None = None 1a

19 

20 

21def upgrade(): 1a

22 # ### commands auto generated by Alembic - please adjust! ### 

23 op.create_table( 1a

24 "recipe_actions", 

25 sa.Column("id", mealie.db.migration_types.GUID(), nullable=False), 

26 sa.Column("group_id", mealie.db.migration_types.GUID(), nullable=False), 

27 sa.Column("action_type", sa.String(), nullable=False), 

28 sa.Column("title", sa.String(), nullable=False), 

29 sa.Column("url", sa.String(), nullable=False), 

30 sa.Column("created_at", sa.DateTime(), nullable=True), 

31 sa.Column("update_at", sa.DateTime(), nullable=True), 

32 sa.ForeignKeyConstraint( 

33 ["group_id"], 

34 ["groups.id"], 

35 ), 

36 sa.PrimaryKeyConstraint("id"), 

37 ) 

38 op.create_index(op.f("ix_recipe_actions_action_type"), "recipe_actions", ["action_type"], unique=False) 1a

39 op.create_index(op.f("ix_recipe_actions_created_at"), "recipe_actions", ["created_at"], unique=False) 1a

40 op.create_index(op.f("ix_recipe_actions_group_id"), "recipe_actions", ["group_id"], unique=False) 1a

41 op.create_index(op.f("ix_recipe_actions_title"), "recipe_actions", ["title"], unique=False) 1a

42 # ### end Alembic commands ### 

43 

44 

45def downgrade(): 1a

46 # ### commands auto generated by Alembic - please adjust! ### 

47 op.drop_index(op.f("ix_recipe_actions_title"), table_name="recipe_actions") 

48 op.drop_index(op.f("ix_recipe_actions_group_id"), table_name="recipe_actions") 

49 op.drop_index(op.f("ix_recipe_actions_created_at"), table_name="recipe_actions") 

50 op.drop_index(op.f("ix_recipe_actions_action_type"), table_name="recipe_actions") 

51 op.drop_table("recipe_actions") 

52 # ### end Alembic commands ###