"""add endpoints.extra_mounts column

Revision ID: c8714799ca0e
Revises: ffbebdf3c2b9
Create Date: 2024-05-19 05:49:06.456819

"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.postgresql import JSONB

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    op.add_column("endpoints", sa.Column("extra_mounts", JSONB, server_default="[]", nullable=True))
    conn.exec_driver_sql("UPDATE ENDPOINTS SET extra_mounts = '[]'::jsonb")
    op.alter_column("endpoints", "extra_mounts", nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("endpoints", "extra_mounts")
    # ### end Alembic commands ###
