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

17 statements  

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

1"""Add `last_polled` to deployment 

2 

3Revision ID: f3165ae0a213 

4Revises: 05ea6f882b1d 

5Create Date: 2023-10-12 17:58:15.326385 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10from alembic import op 1a

11 

12import prefect 1a

13 

14# revision identifiers, used by Alembic. 

15revision = "f3165ae0a213" 1a

16down_revision = "05ea6f882b1d" 1a

17branch_labels = None 1a

18depends_on = None 1a

19 

20 

21def upgrade(): 1a

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

23 

24 with op.batch_alter_table("deployment", schema=None) as batch_op: 1a

25 batch_op.add_column( 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") 1a

34 

35 

36def downgrade(): 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")