Coverage for opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2022-03-31-19.19.55_59eb59135381_add_tags_to_cookbooks.py: 80%

15 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 13:45 +0000

1"""add tags to cookbooks 

2 

3Revision ID: 59eb59135381 

4Revises: f1a2dbee5fe9 

5Create Date: 2022-03-31 19:19:55.428965 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10 

11import mealie.db.migration_types 1a

12from alembic import op 1a

13 

14# revision identifiers, used by Alembic. 

15revision = "59eb59135381" 1a

16down_revision = "f1a2dbee5fe9" 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 "cookbooks_to_tags", 

25 sa.Column("cookbook_id", mealie.db.migration_types.GUID(), nullable=True), 

26 sa.Column("tag_id", mealie.db.migration_types.GUID(), nullable=True), 

27 sa.ForeignKeyConstraint( 

28 ["cookbook_id"], 

29 ["cookbooks.id"], 

30 ), 

31 sa.ForeignKeyConstraint( 

32 ["tag_id"], 

33 ["tags.id"], 

34 ), 

35 ) 

36 op.create_table( 1a

37 "cookbooks_to_tools", 

38 sa.Column("cookbook_id", mealie.db.migration_types.GUID(), nullable=True), 

39 sa.Column("tool_id", mealie.db.migration_types.GUID(), nullable=True), 

40 sa.ForeignKeyConstraint( 

41 ["cookbook_id"], 

42 ["cookbooks.id"], 

43 ), 

44 sa.ForeignKeyConstraint( 

45 ["tool_id"], 

46 ["tools.id"], 

47 ), 

48 ) 

49 op.add_column("cookbooks", sa.Column("public", sa.Boolean(), nullable=True)) 1a

50 # ### end Alembic commands ### 

51 

52 

53def downgrade(): 1a

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

55 op.drop_column("cookbooks", "public") 

56 op.drop_table("cookbooks_to_tools") 

57 op.drop_table("cookbooks_to_tags") 

58 # ### end Alembic commands ###