From df02240386c85742406572bc387bec75dcca69f9 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 09:41:24 +0000 Subject: [PATCH] Add migration for Meal --- .../20250328_094108_ce9e5591_create_meal.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 alembic/versions/20250328_094108_ce9e5591_create_meal.py diff --git a/alembic/versions/20250328_094108_ce9e5591_create_meal.py b/alembic/versions/20250328_094108_ce9e5591_create_meal.py new file mode 100644 index 0000000..db2083d --- /dev/null +++ b/alembic/versions/20250328_094108_ce9e5591_create_meal.py @@ -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') \ No newline at end of file