"""01-users

Revision ID: ade965c19cfd
Revises: 
Create Date: 2025-01-21 02:25:05.518505

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel


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


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Uuid(), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('version', sa.Integer(), nullable=False),
    sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False), # type: ignore
    sa.Column('password_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=False), # type: ignore
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('last_login', sa.TIMESTAMP(timezone=True), nullable=True), # type: ignore
    sa.PrimaryKeyConstraint('id'),
    schema='auth'
    )
    op.create_index(op.f('ix_auth_users_email'), 'users', ['email'], unique=True, schema='auth')
    op.create_index(op.f('ix_auth_users_version'), 'users', ['version'], unique=False, schema='auth')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_auth_users_version'), table_name='users', schema='auth')
    op.drop_index(op.f('ix_auth_users_email'), table_name='users', schema='auth')
    op.drop_table('users', schema='auth')
    # ### end Alembic commands ### 