1 """Add `last_polled` to deployment
2
3 Revision ID: f3165ae0a213
4 Revises: 05ea6f882b1d
5 Create Date: 2023-10-12 17:58:15.326385
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 = "f3165ae0a213" 1 ctx 1a
16 down_revision = "05ea6f882b1d" 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 ( "deployment" , schema = None ) as batch_op : 1 ctx 1a
25 batch_op . add_column ( 1 ctx 1a
26 sa . Column (
27 "last_polled" ,
28 prefect . server . utilities . database . Timestamp ( timezone = True ) ,
29 nullable = True ,
30 )
31 )
32
33 op . execute ( "PRAGMA foreign_keys=ON" ) 1 ctx 1a
34
35
36 def downgrade ( ) : 1 ctx 1a
37 op . execute ( "PRAGMA foreign_keys=OFF" )
38
39 with op . batch_alter_table ( "deployment" , schema = None ) as batch_op :
40 batch_op . drop_column ( "last_polled" )
41
42 op . execute ( "PRAGMA foreign_keys=ON" )