1 """add extras to shopping lists, list items, and ingredient foods
2
3 Revision ID: 44e8d670719d
4 Revises: 089bfa50d0ed
5 Create Date: 2022-08-29 13:57:40.452245
6
7 """
8
9 import sqlalchemy as sa 1 ctx 1a
10
11 import mealie . db . migration_types 1 ctx 1a
12 from alembic import op 1 ctx 1a
13
14 # revision identifiers, used by Alembic.
15 revision = "44e8d670719d" 1 ctx 1a
16 down_revision = "089bfa50d0ed" 1 ctx 1a
17 branch_labels : str | tuple [ str , ... ] | None = None 1 ctx 1a
18 depends_on : str | tuple [ str , ... ] | None = None 1 ctx 1a
19
20
21 def upgrade ( ) : 1 ctx 1a
22 # ### commands auto generated by Alembic - please adjust! ###
23 op . create_table ( 1 ctx 1a
24 "shopping_list_extras" ,
25 sa . Column ( "created_at" , sa . DateTime ( ) , nullable = True ) ,
26 sa . Column ( "update_at" , sa . DateTime ( ) , nullable = True ) ,
27 sa . Column ( "id" , sa . Integer ( ) , nullable = False ) ,
28 sa . Column ( "key_name" , sa . String ( ) , nullable = True ) ,
29 sa . Column ( "value" , sa . String ( ) , nullable = True ) ,
30 sa . Column ( "shopping_list_id" , mealie . db . migration_types . GUID ( ) , nullable = True ) ,
31 sa . ForeignKeyConstraint (
32 [ "shopping_list_id" ] ,
33 [ "shopping_lists.id" ] ,
34 ) ,
35 sa . PrimaryKeyConstraint ( "id" ) ,
36 )
37 op . create_table ( 1 ctx 1a
38 "ingredient_food_extras" ,
39 sa . Column ( "created_at" , sa . DateTime ( ) , nullable = True ) ,
40 sa . Column ( "update_at" , sa . DateTime ( ) , nullable = True ) ,
41 sa . Column ( "id" , sa . Integer ( ) , nullable = False ) ,
42 sa . Column ( "key_name" , sa . String ( ) , nullable = True ) ,
43 sa . Column ( "value" , sa . String ( ) , nullable = True ) ,
44 sa . Column ( "ingredient_food_id" , mealie . db . migration_types . GUID ( ) , nullable = True ) ,
45 sa . ForeignKeyConstraint (
46 [ "ingredient_food_id" ] ,
47 [ "ingredient_foods.id" ] ,
48 ) ,
49 sa . PrimaryKeyConstraint ( "id" ) ,
50 )
51 op . create_table ( 1 ctx 1a
52 "shopping_list_item_extras" ,
53 sa . Column ( "created_at" , sa . DateTime ( ) , nullable = True ) ,
54 sa . Column ( "update_at" , sa . DateTime ( ) , nullable = True ) ,
55 sa . Column ( "id" , sa . Integer ( ) , nullable = False ) ,
56 sa . Column ( "key_name" , sa . String ( ) , nullable = True ) ,
57 sa . Column ( "value" , sa . String ( ) , nullable = True ) ,
58 sa . Column ( "shopping_list_item_id" , mealie . db . migration_types . GUID ( ) , nullable = True ) ,
59 sa . ForeignKeyConstraint (
60 [ "shopping_list_item_id" ] ,
61 [ "shopping_list_items.id" ] ,
62 ) ,
63 sa . PrimaryKeyConstraint ( "id" ) ,
64 )
65 # ### end Alembic commands ###
66
67
68 def downgrade ( ) : 1 ctx 1a
69 # ### commands auto generated by Alembic - please adjust! ###
70 op . drop_table ( "shopping_list_item_extras" )
71 op . drop_table ( "ingredient_food_extras" )
72 op . drop_table ( "shopping_list_extras" )
73 # ### end Alembic commands ###