"""Ajout architecture Team Members (parent_id)

Revision ID: a8703d5aacbb
Revises: 1cbb5a63f3e2
Create Date: 2026-01-08 14:19:24.914287

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a8703d5aacbb'
down_revision = '1cbb5a63f3e2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.add_column(sa.Column('parent_id', sa.String(length=36), nullable=True))
        batch_op.create_index(batch_op.f('ix_users_parent_id'), ['parent_id'], unique=False)
        batch_op.create_foreign_key(None, 'users', ['parent_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_index(batch_op.f('ix_users_parent_id'))
        batch_op.drop_column('parent_id')

    # ### end Alembic commands ###
