1 """Add cols to artifact_collection
2
3 Revision ID: 3e1eb8281d5e
4 Revises: 553920ec20e9
5 Create Date: 2023-04-04 17:25:55.589739
6
7 """
8
9 import sqlalchemy as sa 1 ctx 1a
10 from alembic import op 1 ctx 1a
11
12 import prefect 1 ctx 1a
13
14 # revision identifiers, used by Alembic.
15 revision = "3e1eb8281d5e" 1 ctx 1a
16 down_revision = "553920ec20e9" 1 ctx 1a
17 branch_labels = None 1 ctx 1a
18 depends_on = None 1 ctx 1a
19
20
21 def upgrade ( ) : 1 ctx 1a
22 op . execute ( "PRAGMA foreign_keys=OFF" ) 1 ctx 1a
23
24 with op . batch_alter_table ( "artifact_collection" , schema = None ) as batch_op : 1 ctx 1a
25 batch_op . add_column ( 1 ctx 1a
26 sa . Column (
27 "task_run_id" , prefect . server . utilities . database . UUID ( ) , nullable = True
28 )
29 )
30 batch_op . add_column ( 1 ctx 1a
31 sa . Column (
32 "flow_run_id" , prefect . server . utilities . database . UUID ( ) , nullable = True
33 )
34 )
35 batch_op . add_column ( sa . Column ( "type" , sa . String ( ) , nullable = True ) ) 1 ctx 1a
36 batch_op . add_column ( sa . Column ( "data" , sa . JSON ( ) , nullable = True ) ) 1 ctx 1a
37 batch_op . add_column ( sa . Column ( "description" , sa . String ( ) , nullable = True ) ) 1 ctx 1a
38 batch_op . add_column ( sa . Column ( "metadata_" , sa . JSON ( ) , nullable = True ) ) 1 ctx 1a
39
40 op . execute ( "PRAGMA foreign_keys=ON" ) 1 ctx 1a
41
42
43 def downgrade ( ) : 1 ctx 1a
44 op . execute ( "PRAGMA foreign_keys=OFF" )
45
46 with op . batch_alter_table ( "artifact_collection" , schema = None ) as batch_op :
47 batch_op . drop_column ( "metadata_" )
48 batch_op . drop_column ( "description" )
49 batch_op . drop_column ( "data" )
50 batch_op . drop_column ( "type" )
51 batch_op . drop_column ( "flow_run_id" )
52 batch_op . drop_column ( "task_run_id" )
53
54 op . execute ( "PRAGMA foreign_keys=ON" )