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

11 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 02:04 +0000

1"""Remove Artifact foreign keys 

2 

3Revision ID: cfdfec5d7557 

4Revises: 2a88656f4a23 

5Create Date: 2023-02-08 15:19:58.751027 

6 

7""" 

8 

9from alembic import op 

10 

11# revision identifiers, used by Alembic. 

12revision = "cfdfec5d7557" 

13down_revision = "2a88656f4a23" 

14branch_labels = None 

15depends_on = None 

16 

17 

18def upgrade(): 

19 op.drop_constraint( 

20 "fk_artifact__task_run_id__task_run", "artifact", type_="foreignkey" 

21 ) 

22 op.drop_constraint( 

23 "fk_artifact__flow_run_id__flow_run", "artifact", type_="foreignkey" 

24 ) 

25 

26 

27def downgrade(): 

28 op.create_foreign_key( 

29 "fk_artifact__flow_run_id__flow_run", 

30 "artifact", 

31 "flow_run", 

32 ["flow_run_id"], 

33 ["id"], 

34 ) 

35 op.create_foreign_key( 

36 "fk_artifact__task_run_id__task_run", 

37 "artifact", 

38 "task_run", 

39 ["task_run_id"], 

40 ["id"], 

41 )