"""add account_id and account_role columns to users

Revision ID: 017
Revises: 016
Create Date: 2026-02-07

"""
from typing import Sequence, Union

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


# revision identifiers, used by Alembic.
revision: str = '017'
down_revision: Union[str, None] = '016'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column('users', sa.Column('account_id', UUID(as_uuid=True), nullable=True))
    op.add_column('users', sa.Column('account_role', sa.String(50), nullable=True))
    op.create_index('ix_users_account_id', 'users', ['account_id'])


def downgrade() -> None:
    op.drop_index('ix_users_account_id', table_name='users')
    op.drop_column('users', 'account_role')
    op.drop_column('users', 'account_id')
