#7 Basic flask app. Setup routes, DB, and made a user model. Made initial migrations

This commit is contained in:
2023-03-16 19:39:58 -04:00
parent dcc172f17a
commit 73bdc75095
14 changed files with 359 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
"""empty message
Revision ID: 7736bc740f9b
Revises:
Create Date: 2023-03-16 19:20:29.115598
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7736bc740f9b'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=64), nullable=True),
sa.Column('email', sa.String(length=120), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('about_me', sa.String(length=140), nullable=True),
sa.Column('last_seen', sa.DateTime(), nullable=True),
sa.Column('token', sa.String(length=32), nullable=True),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_user_email'), ['email'], unique=True)
batch_op.create_index(batch_op.f('ix_user_token'), ['token'], unique=True)
batch_op.create_index(batch_op.f('ix_user_username'), ['username'], unique=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_user_username'))
batch_op.drop_index(batch_op.f('ix_user_token'))
batch_op.drop_index(batch_op.f('ix_user_email'))
op.drop_table('user')
# ### end Alembic commands ###