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

15 statements  

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

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

2 

3Revision ID: 1d7441c031d0 

4Revises: cf1159bd0d3c 

5Create Date: 2023-03-20 15:39:25.077241 

6 

7""" 

8 

9from alembic import op 1a

10 

11# revision identifiers, used by Alembic. 

12revision = "1d7441c031d0" 1a

13down_revision = "cf1159bd0d3c" 1a

14branch_labels = None 1a

15depends_on = None 1a

16 

17 

18def upgrade(): 1a

19 op.execute("PRAGMA foreign_keys=OFF") 1a

20 op.drop_index(op.f("ix_artifact__key"), table_name="artifact") 1a

21 op.create_index( 1a

22 op.f("ix_artifact__key"), 

23 "artifact", 

24 ["key"], 

25 unique=False, 

26 ) 

27 op.execute("PRAGMA foreign_keys=ON") 1a

28 

29 

30def downgrade(): 1a

31 op.execute("PRAGMA foreign_keys=OFF") 

32 op.drop_index(op.f("ix_artifact__key"), table_name="artifact") 

33 op.create_index( 

34 op.f("ix_artifact__key"), 

35 "artifact", 

36 ["key"], 

37 unique=True, 

38 ) 

39 op.execute("PRAGMA foreign_keys=ON")