"""fix typo in column name

Revision ID: ffbebdf3c2b9
Revises: 38741c85f228
Create Date: 2024-05-20 11:30:59.083088

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "ffbebdf3c2b9"
down_revision = "38741c85f228"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    op.add_column(
        "endpoints",
        sa.Column(
            "model_mount_destination",
            sa.String(length=1024),
            server_default="/models",
            nullable=False,
        ),
    )
    conn.exec_driver_sql("UPDATE endpoints SET model_mount_destination = model_mount_destiation")
    op.drop_column("endpoints", "model_mount_destiation")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    op.add_column(
        "endpoints",
        sa.Column(
            "model_mount_destiation",
            sa.VARCHAR(length=1024),
            server_default=sa.text("'/models'::character varying"),
            autoincrement=False,
            nullable=False,
        ),
    )
    conn.exec_driver_sql("UPDATE endpoints SET model_mount_destiation = model_mount_destination")
    op.drop_column("endpoints", "model_mount_destination")
    # ### end Alembic commands ###
