"""create user tables

Revision ID: 335e07a98bc8
Revises: 
Create Date: 2023-05-12 19:59:22.188464

"""
from alembic import op
from sqlalchemy import Column, Integer, String, DateTime, Boolean
from sqlalchemy.sql.functions import now


# revision identifiers, used by Alembic.
revision = '335e07a98bc8'
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.create_table(
        'users',
        Column('id', Integer, primary_key=True, autoincrement=True, index=True),
        Column('email', String, unique=True, nullable=False, index=True),
        Column('password', String, nullable=False),
        Column('created', DateTime(timezone=True), nullable=False, server_default=now()),
        Column('updated', DateTime(timezone=True), nullable=False, server_default=now(), onupdate=now()),
        Column('first_name', String, nullable=False),
        Column('last_name', String, nullable=False, index=True),
        Column('is_admin', Boolean, nullable=False, default=False, index=True),
    )


def downgrade() -> None:
    op.drop_table('users')
