bossy-restaurant-2uye8v/alembic/versions/20250328_094108_ce9e5591_create_meal.py
2025-03-28 09:41:24 +00:00

37 lines
1.1 KiB
Python

"""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')