Skip to content

Commit c96dc62

Browse files
authored
Fix rolling deployment migration locking (#2904)
1 parent e3b292d commit c96dc62

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/dstack/_internal/server/migrations/versions/35e90e1b0d3e_add_rolling_deployment_fields.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717

1818

1919
def upgrade() -> None:
20-
with op.batch_alter_table("jobs", schema=None) as batch_op:
21-
batch_op.add_column(sa.Column("deployment_num", sa.Integer(), nullable=True))
22-
with op.batch_alter_table("jobs", schema=None) as batch_op:
23-
batch_op.execute("UPDATE jobs SET deployment_num = 0")
24-
batch_op.alter_column("deployment_num", nullable=False)
25-
2620
with op.batch_alter_table("runs", schema=None) as batch_op:
2721
batch_op.add_column(sa.Column("deployment_num", sa.Integer(), nullable=True))
2822
batch_op.add_column(sa.Column("desired_replica_count", sa.Integer(), nullable=True))
@@ -32,6 +26,12 @@ def upgrade() -> None:
3226
batch_op.alter_column("deployment_num", nullable=False)
3327
batch_op.alter_column("desired_replica_count", nullable=False)
3428

29+
with op.batch_alter_table("jobs", schema=None) as batch_op:
30+
batch_op.add_column(sa.Column("deployment_num", sa.Integer(), nullable=True))
31+
with op.batch_alter_table("jobs", schema=None) as batch_op:
32+
batch_op.execute("UPDATE jobs SET deployment_num = 0")
33+
batch_op.alter_column("deployment_num", nullable=False)
34+
3535

3636
def downgrade() -> None:
3737
with op.batch_alter_table("runs", schema=None) as batch_op:

0 commit comments

Comments
 (0)