"""recreate_servidores_table

Revision ID: 0812272a350b
Revises: 3b8010f0a934
Create Date: 2026-06-25 21:53:35.435657

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '0812272a350b'
down_revision: Union[str, None] = '3b8010f0a934'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('servidores',
    sa.Column('nombre', sa.String(length=100), nullable=False),
    sa.Column('edad', sa.Integer(), nullable=False),
    sa.Column('fecha_nacimiento', sa.Date(), nullable=True),
    sa.Column('cedula', sa.Integer(), nullable=False),
    sa.Column('celular', sa.String(length=20), nullable=True),
    sa.Column('correo', sa.String(length=100), nullable=True),
    sa.Column('numero_equipo', sa.Integer(), nullable=True),
    sa.Column('id_capitan', sa.Integer(), nullable=True),
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('sync_id', sa.String(length=36), nullable=False),
    sa.Column('is_deleted', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['id_capitan'], ['capitanes.id'], name=op.f('fk_servidores_id_capitan_capitanes')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_servidores')),
    sa.UniqueConstraint('cedula', name=op.f('uq_servidores_cedula')),
    sa.UniqueConstraint('correo', name=op.f('uq_servidores_correo'))
    )
    with op.batch_alter_table('servidores', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_servidores_id'), ['id'], unique=False)
        batch_op.create_index(batch_op.f('ix_servidores_sync_id'), ['sync_id'], unique=True)

    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('servidores', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_servidores_sync_id'))
        batch_op.drop_index(batch_op.f('ix_servidores_id'))

    op.drop_table('servidores')
    # ### end Alembic commands ###
