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

13 statements  

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

1"""Make slot_decay_per_second not nullable 

2 

3Revision ID: 8167af8df781 

4Revises: ef674d598dd3 

5Create Date: 2023-09-21 12:18:06.722322 

6 

7""" 

8 

9import sqlalchemy as sa 1a

10from alembic import op 1a

11 

12# revision identifiers, used by Alembic. 

13revision = "8167af8df781" 1a

14down_revision = "ef674d598dd3" 1a

15branch_labels = None 1a

16depends_on = None 1a

17 

18 

19def upgrade(): 1a

20 op.execute( 1a

21 "UPDATE concurrency_limit_v2 SET slot_decay_per_second = 0.0 WHERE" 

22 " slot_decay_per_second is null" 

23 ) 

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

25 batch_op.alter_column( 1a

26 "slot_decay_per_second", existing_type=sa.FLOAT(), nullable=False 

27 ) 

28 

29 

30def downgrade(): 1a

31 with op.batch_alter_table("concurrency_limit_v2", schema=None) as batch_op: 

32 batch_op.alter_column( 

33 "slot_decay_per_second", existing_type=sa.FLOAT(), nullable=True 

34 )