45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
"""create User table
|
|
|
|
Revision ID: 9741fc7834da
|
|
Revises:
|
|
Create Date: 2018-01-20 18:59:49.200032
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '9741fc7834da'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('users',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('username', sa.String(length=20), nullable=False),
|
|
sa.Column('email', sa.String(length=120), nullable=False),
|
|
sa.Column('password', sa.String(length=255), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
sa.Column('admin', sa.Boolean(), nullable=False),
|
|
sa.Column('first_name', sa.String(length=80), nullable=True),
|
|
sa.Column('last_name', sa.String(length=80), nullable=True),
|
|
sa.Column('birth_date', sa.DateTime(), nullable=True),
|
|
sa.Column('location', sa.String(length=80), nullable=True),
|
|
sa.Column('bio', sa.String(length=200), nullable=True),
|
|
sa.Column('picture', sa.String(length=255), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('email'),
|
|
sa.UniqueConstraint('username')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('users')
|
|
# ### end Alembic commands ###
|