"""Add credential status for provider table

Revision ID: cf7c38a32b2d
Revises: c20211f18133
Create Date: 2025-09-11 15:37:17.771298

"""
from alembic import op
import models as models

def _is_pg(conn):
    return conn.dialect.name == "postgresql"
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'cf7c38a32b2d'
down_revision = 'c20211f18133'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    
    if _is_pg(conn):
        with op.batch_alter_table('providers', schema=None) as batch_op:
            batch_op.add_column(sa.Column('credential_status', sa.String(length=20), server_default=sa.text("'active'::character varying"), nullable=True))
    else:
        with op.batch_alter_table('providers', schema=None) as batch_op:
            batch_op.add_column(sa.Column('credential_status', sa.String(length=20), server_default=sa.text("'active'"), nullable=True))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('providers', schema=None) as batch_op:
        batch_op.drop_column('credential_status')

    # ### end Alembic commands ###