FitTrackee/fittrackee/migrations/versions/01_9741fc7834da_create_user_table.py

45 lines
1.4 KiB
Python
Raw Permalink Normal View History

"""create User table
2018-01-20 19:12:34 +01:00
Revision ID: 9741fc7834da
2018-01-20 19:24:30 +01:00
Revises:
2018-01-20 19:12:34 +01:00
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 ###