1 """Removes unique constraint from artifact table key column
2
3 Revision ID: 1d7441c031d0
4 Revises: cf1159bd0d3c
5 Create Date: 2023-03-20 15:39:25.077241
6
7 """
8
9 from alembic import op 1 ctx 1a
10
11 # revision identifiers, used by Alembic.
12 revision = "1d7441c031d0" 1 ctx 1a
13 down_revision = "cf1159bd0d3c" 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 op . drop_index ( op . f ( "ix_artifact__key" ) , table_name = "artifact" ) 1 ctx 1a
21 op . create_index ( 1 ctx 1a
22 op . f ( "ix_artifact__key" ) ,
23 "artifact" ,
24 [ "key" ] ,
25 unique = False ,
26 )
27 op . execute ( "PRAGMA foreign_keys=ON" ) 1 ctx 1a
28
29
30 def downgrade ( ) : 1 ctx 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" )