"""Adding specialist information to BusinessEventLog

Revision ID: 03a1e7633c01
Revises: 4d2842d9c1d0
Create Date: 2025-03-24 14:28:57.200173

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '03a1e7633c01'
down_revision = '4d2842d9c1d0'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('business_event_log', schema=None) as batch_op:
        batch_op.add_column(sa.Column('specialist_id', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('specialist_type', sa.String(length=50), nullable=True))
        batch_op.add_column(sa.Column('specialist_type_version', sa.String(length=20), nullable=True))
        batch_op.drop_constraint('business_event_log_license_usage_id_fkey', type_='foreignkey')
        batch_op.create_foreign_key(None, 'license_usage', ['license_usage_id'], ['id'], referent_schema='public')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('business_event_log', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.create_foreign_key('business_event_log_license_usage_id_fkey', 'license_usage', ['license_usage_id'], ['id'])
        batch_op.drop_column('specialist_type_version')
        batch_op.drop_column('specialist_type')
        batch_op.drop_column('specialist_id')

    # ### end Alembic commands ###
