Chore: Squash core migrations into one baseline

This commit is contained in:
2026-08-31 20:32:01 +05:45
parent e5b2a54db8
commit efda0f4e8f
5 changed files with 414 additions and 639 deletions
@@ -1,31 +0,0 @@
"""Add VM scheduling retry fields to workloads table
Revision ID: 0001_workload_vm_retry_fields
Revises: 0000_merged_all_migrations
Create Date: 2026-06-07
"""
from alembic import op
import sqlalchemy as sa
revision = '0001_workload_vm_retry_fields'
down_revision = '0000_merged_all_migrations'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('workloads', schema=None) as batch_op:
batch_op.add_column(sa.Column('allocation_attempts', sa.Integer(), nullable=False, server_default='0'))
batch_op.add_column(sa.Column('max_allocation_attempts', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('next_retry_at', sa.DateTime(), nullable=True))
batch_op.add_column(sa.Column('last_attempt_at', sa.DateTime(), nullable=True))
batch_op.add_column(sa.Column('last_error_reason', sa.String(255), nullable=True))
def downgrade():
with op.batch_alter_table('workloads', schema=None) as batch_op:
batch_op.drop_column('last_error_reason')
batch_op.drop_column('last_attempt_at')
batch_op.drop_column('next_retry_at')
batch_op.drop_column('max_allocation_attempts')
batch_op.drop_column('allocation_attempts')
@@ -1,23 +0,0 @@
"""Add excluded_host_ids to workloads for retry host exclusion
Revision ID: 0002_workload_excluded_hosts
Revises: 0001_workload_vm_retry_fields
Create Date: 2026-06-11
"""
from alembic import op
import sqlalchemy as sa
revision = '0002_workload_excluded_hosts'
down_revision = '0001_workload_vm_retry_fields'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('workloads', schema=None) as batch_op:
batch_op.add_column(sa.Column('excluded_host_ids', sa.JSON(), nullable=True))
def downgrade():
with op.batch_alter_table('workloads', schema=None) as batch_op:
batch_op.drop_column('excluded_host_ids')
@@ -1,23 +0,0 @@
"""Add enable_host_nat to networks for NSController internet egress via NAT
Revision ID: 0003_network_enable_host_nat
Revises: 0002_workload_excluded_hosts
Create Date: 2026-08-08
"""
from alembic import op
import sqlalchemy as sa
revision = '0003_network_enable_host_nat'
down_revision = '0002_workload_excluded_hosts'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('networks', schema=None) as batch_op:
batch_op.add_column(sa.Column('enable_host_nat', sa.Boolean(), nullable=False, server_default='0'))
def downgrade():
with op.batch_alter_table('networks', schema=None) as batch_op:
batch_op.drop_column('enable_host_nat')
@@ -0,0 +1,23 @@
"""Drop audit_entry.user_id.
Core has no users: the only credential it accepts is XCLOUDIFY_API_KEY, so
there is no actor to record. The column was filled from a JWT that no plane
sends to core any more.
"""
from alembic import op
import sqlalchemy as sa
revision = '0008_drop_audit_user_id'
down_revision = '0007_cloudflare_out'
branch_labels = None
depends_on = None
def upgrade():
columns = [c['name'] for c in sa.inspect(op.get_bind()).get_columns('audit_entry')]
if 'user_id' in columns:
op.drop_column('audit_entry', 'user_id')
def downgrade():
op.add_column('audit_entry', sa.Column('user_id', sa.String(length=36), nullable=True))