Add migration for Meal
This commit is contained in:
parent
0d925351fa
commit
fd1a5f309e
35
alembic/versions/20250327_121910_319763af_create_meal.py
Normal file
35
alembic/versions/20250327_121910_319763af_create_meal.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"""create meals table
|
||||||
|
|
||||||
|
Revision ID: 2d7a4b6c8f94
|
||||||
|
Revises: 0001
|
||||||
|
Create Date: 2023-05-10 14:23:54.987289
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '2d7a4b6c8f94'
|
||||||
|
down_revision = '0001'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'meals',
|
||||||
|
sa.Column('id', sa.String(), primary_key=True, default=lambda: str(uuid.uuid4())),
|
||||||
|
sa.Column('name', sa.String(), nullable=False, index=True),
|
||||||
|
sa.Column('description', sa.String(), nullable=True),
|
||||||
|
sa.Column('price', sa.Float(), nullable=False),
|
||||||
|
sa.Column('category', sa.String(), nullable=True, index=True),
|
||||||
|
sa.Column('is_available', sa.Boolean(), default=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(), server_default=func.now()),
|
||||||
|
sa.Column('updated_at', sa.DateTime(), server_default=func.now(), onupdate=func.now())
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_table('meals')
|
Loading…
x
Reference in New Issue
Block a user