Add migration for Meal
This commit is contained in:
parent
df5a735b42
commit
df02240386
37
alembic/versions/20250328_094108_ce9e5591_create_meal.py
Normal file
37
alembic/versions/20250328_094108_ce9e5591_create_meal.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
"""create meals table
|
||||||
|
|
||||||
|
Revision ID: 9d0e4bcd7e8f
|
||||||
|
Revises: 2c8d9938e6a4
|
||||||
|
Create Date: 2023-05-11 15:23:47.852116
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects.postgresql import UUID, JSON
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '9d0e4bcd7e8f'
|
||||||
|
down_revision = '2c8d9938e6a4'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'meals',
|
||||||
|
sa.Column('id', UUID(as_uuid=True), primary_key=True, nullable=False),
|
||||||
|
sa.Column('name', sa.String, nullable=False),
|
||||||
|
sa.Column('description', sa.Text, nullable=True),
|
||||||
|
sa.Column('price', sa.Float, nullable=False),
|
||||||
|
sa.Column('is_available', sa.Boolean, default=True),
|
||||||
|
sa.Column('category', sa.String, nullable=True),
|
||||||
|
sa.Column('cuisine', sa.String, nullable=True),
|
||||||
|
sa.Column('dietary_restrictions', JSON, nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime, server_default=func.now(), nullable=False),
|
||||||
|
sa.Column('updated_at', sa.DateTime, server_default=func.now(), onupdate=func.now(), nullable=False)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_table('meals')
|
Loading…
x
Reference in New Issue
Block a user