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

13 statements  

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

1"""Removes unique constraint from artifact table key column 

2Revision ID: aa84ac237ce8 

3Revises: 4a1a0e4f89de 

4Create Date: 2023-03-20 17:52:43.438841 

5""" 

6 

7from alembic import op 

8 

9# revision identifiers, used by Alembic. 

10revision = "aa84ac237ce8" 

11down_revision = "4a1a0e4f89de" 

12branch_labels = None 

13depends_on = None 

14 

15 

16def upgrade(): 

17 with op.batch_alter_table("artifact", schema=None) as batch_op: 

18 batch_op.drop_index("ix_artifact__key") 

19 batch_op.create_index( 

20 "ix_artifact__key", 

21 ["key"], 

22 unique=False, 

23 ) 

24 

25 

26def downgrade(): 

27 with op.batch_alter_table("artifact", schema=None) as batch_op: 

28 batch_op.drop_index("ix_artifact__key") 

29 batch_op.create_index( 

30 "ix_artifact__key", 

31 ["key"], 

32 unique=True, 

33 )