2023-05-21 01:50:44 +01:00
|
|
|
"""create user tables
|
|
|
|
|
|
|
|
Revision ID: 335e07a98bc8
|
|
|
|
Revises:
|
|
|
|
Create Date: 2023-05-12 19:59:22.188464
|
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
2023-05-31 16:37:56 +01:00
|
|
|
from sqlalchemy import Column, Integer, String, DateTime, Boolean
|
2023-05-21 01:50:44 +01:00
|
|
|
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),
|
2023-05-22 12:44:10 +01:00
|
|
|
Column('email', String, unique=True, nullable=False, index=True),
|
2023-05-21 01:50:44 +01:00
|
|
|
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),
|
2023-05-22 12:44:10 +01:00
|
|
|
Column('last_name', String, nullable=False, index=True),
|
2023-05-31 16:37:56 +01:00
|
|
|
Column('is_admin', Boolean, nullable=False, default=False, index=True),
|
2023-05-21 01:50:44 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade() -> None:
|
|
|
|
op.drop_table('users')
|