"""Add azure as a SSO provider

Revision ID: 1c8dfd6a1bc6
Revises: 4ebe0766021b
Create Date: 2024-10-21 18:04:29.130138

"""

from alembic import op

# revision identifiers, used by Alembic.
revision = "1c8dfd6a1bc6"
down_revision = "4ebe0766021b"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("alter type providerenum add value 'azure'")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("delete from openid_provider where provider in ('azure')")
    op.execute("alter type providerenum rename to providerenum_old")
    op.execute("create type providerenum as enum('google','okta','custom')")
    op.execute(
        (
            "alter table openid_provider alter column provider type providerenum using "
            "openid_provider::text::providerenum;"
        )
    )
    op.execute("drop type providerenum_old")
    # ### end Alembic commands ###
