1 """Make `FlowRunInput.flow_run_id` a foreign key to `flow_run`
2
3 Revision ID: 35659cc49969
4 Revises: a299308852a7
5 Create Date: 2023-12-07 12:16:24.287059
6
7 """
8
9 from alembic import op 1 ctx 1a
10
11 # revision identifiers, used by Alembic.
12 revision = "35659cc49969" 1 ctx 1a
13 down_revision = "a299308852a7" 1 ctx 1a
14 branch_labels = None 1 ctx 1a
15 depends_on = None 1 ctx 1a
16
17
18 def upgrade ( ) : 1 ctx 1a
19 with op . batch_alter_table ( "flow_run_input" , schema = None ) as batch_op : 1 ctx 1a
20 batch_op . create_foreign_key ( 1 ctx 1a
21 batch_op . f ( "fk_flow_run_input__flow_run_id__flow_run" ) ,
22 "flow_run" ,
23 [ "flow_run_id" ] ,
24 [ "id" ] ,
25 ondelete = "cascade" ,
26 )
27
28
29 def downgrade ( ) : 1 ctx 1a
30 with op . batch_alter_table ( "flow_run_input" , schema = None ) as batch_op :
31 batch_op . drop_constraint (
32 batch_op . f ( "fk_flow_run_input__flow_run_id__flow_run" ) , type_ = "foreignkey"
33 )