Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/database/_migrations/versions/sqlite/2023_12_07_121624_35659cc49969_make_flowruninput_flow_run_id_a_foreign_.py: 82%

11 statements  

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

1"""Make `FlowRunInput.flow_run_id` a foreign key to `flow_run` 

2 

3Revision ID: 35659cc49969 

4Revises: a299308852a7 

5Create Date: 2023-12-07 12:16:24.287059 

6 

7""" 

8 

9from alembic import op 1a

10 

11# revision identifiers, used by Alembic. 

12revision = "35659cc49969" 1a

13down_revision = "a299308852a7" 1a

14branch_labels = None 1a

15depends_on = None 1a

16 

17 

18def upgrade(): 1a

19 with op.batch_alter_table("flow_run_input", schema=None) as batch_op: 1a

20 batch_op.create_foreign_key( 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 

29def downgrade(): 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 )