1 """Make slot_decay_per_second not nullable
2
3 Revision ID: 8167af8df781
4 Revises: ef674d598dd3
5 Create Date: 2023-09-21 12:18:06.722322
6
7 """
8
9 import sqlalchemy as sa 1 ctx 1a
10 from alembic import op 1 ctx 1a
11
12 # revision identifiers, used by Alembic.
13 revision = "8167af8df781" 1 ctx 1a
14 down_revision = "ef674d598dd3" 1 ctx 1a
15 branch_labels = None 1 ctx 1a
16 depends_on = None 1 ctx 1a
17
18
19 def upgrade ( ) : 1 ctx 1a
20 op . execute ( 1 ctx 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 : 1 ctx 1a
25 batch_op . alter_column ( 1 ctx 1a
26 "slot_decay_per_second" , existing_type = sa . FLOAT ( ) , nullable = False
27 )
28
29
30 def downgrade ( ) : 1 ctx 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 )