From 7ce496de56f29a77de7464ea91b1b6e135a3c4ce Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 16:01:02 +0000 Subject: [PATCH] Add migration for Food --- .../20250328_160053_2d6f8e66_create_food.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 alembic/versions/20250328_160053_2d6f8e66_create_food.py diff --git a/alembic/versions/20250328_160053_2d6f8e66_create_food.py b/alembic/versions/20250328_160053_2d6f8e66_create_food.py new file mode 100644 index 0000000..9f82124 --- /dev/null +++ b/alembic/versions/20250328_160053_2d6f8e66_create_food.py @@ -0,0 +1,34 @@ +"""create foods table + +Revision ID: 1d8f6e7c0329 +Revises: 6d7a3c2b1f5a +Create Date: 2023-05-10 15:24:57.821405 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.sql import func + +# revision identifiers, used by Alembic. +revision = '1d8f6e7c0329' +down_revision = '6d7a3c2b1f5a' +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + 'foods', + sa.Column('id', UUID(as_uuid=True), primary_key=True, nullable=False), + sa.Column('name', sa.String, nullable=False), + sa.Column('description', sa.String, nullable=True), + sa.Column('price', sa.Float, nullable=False), + sa.Column('restaurant_id', UUID(as_uuid=True), nullable=False), + 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('foods') \ No newline at end of file