1 """remove_flowrun_deployment_fk
2
3 Revision ID: f3df94dca3cc
4 Revises: 8d148e44e669
5 Create Date: 2023-03-01 16:55:51.274067
6
7 """
8
9 from alembic import op 1 ctx 1a
10
11 # revision identifiers, used by Alembic.
12 revision = "f3df94dca3cc" 1 ctx 1a
13 down_revision = "8d148e44e669" 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 op . execute ( "PRAGMA foreign_keys=OFF" ) 1 ctx 1a
20
21 with op . batch_alter_table ( "flow_run" , schema = None ) as batch_op : 1 ctx 1a
22 batch_op . drop_constraint ( 1 ctx 1a
23 "fk_flow_run__deployment_id__deployment" , type_ = "foreignkey"
24 )
25
26 op . execute ( "PRAGMA foreign_keys=ON" ) 1 ctx 1a
27
28
29 def downgrade ( ) : 1 ctx 1a
30 op . execute ( "PRAGMA foreign_keys=OFF" )
31
32 with op . batch_alter_table ( "flow_run" , schema = None ) as batch_op :
33 batch_op . create_foreign_key (
34 "fk_flow_run__deployment_id__deployment" ,
35 "deployment" ,
36 [ "deployment_id" ] ,
37 [ "id" ] ,
38 )
39
40 op . execute ( "PRAGMA foreign_keys=ON" )