changes
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""remove ssh fields and add rest scheme
|
||||
|
||||
Revision ID: 0002_remove_ssh_add_rest_scheme
|
||||
Revises: 0001
|
||||
Create Date: 2026-03-06 00:00:00.000000
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = "0002_remove_ssh_add_rest_scheme"
|
||||
down_revision = "0001"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table("devices", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("rest_scheme", sa.String(length=8), nullable=False, server_default="https"))
|
||||
batch_op.drop_column("ssh_enabled")
|
||||
batch_op.drop_column("ssh_port")
|
||||
op.execute("UPDATE devices SET rest_scheme = 'https' WHERE rest_scheme IS NULL OR rest_scheme = ''")
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table("devices", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("ssh_port", sa.Integer(), nullable=False, server_default="22"))
|
||||
batch_op.add_column(sa.Column("ssh_enabled", sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
batch_op.drop_column("rest_scheme")
|
||||
Reference in New Issue
Block a user