Event-CRUD-Flask-python3-API/migrations/versions/bb3a88007475_initial_migration.py

50 lines
1.6 KiB
Python
Raw Normal View History

2024-01-07 14:21:35 +00:00
"""initial migration
Revision ID: bb3a88007475
Revises:
Create Date: 2024-01-07 14:12:47.164418
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bb3a88007475'
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.String(length=36), nullable=False),
sa.Column('name', sa.String(length=100), nullable=True),
sa.Column('email', sa.String(length=120), nullable=False),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('location', sa.String(length=100), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
op.create_table('event',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=100), nullable=False),
sa.Column('description', sa.String(length=200), nullable=True),
sa.Column('location', sa.String(length=100), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('duedate', sa.DateTime(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('user_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('event')
op.drop_table('user')
# ### end Alembic commands ###