This commit is contained in:
Mateusz Gruszczyński
2026-03-06 10:06:14 +01:00
parent e8f6c4c609
commit 7b8a81dc3b
28 changed files with 1270 additions and 312 deletions

View File

@@ -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")