diff --git a/alembic/versions/20250328_135301_7412a8fc_create_food.py b/alembic/versions/20250328_135301_7412a8fc_create_food.py new file mode 100644 index 0000000..dee8014 --- /dev/null +++ b/alembic/versions/20250328_135301_7412a8fc_create_food.py @@ -0,0 +1,34 @@ +"""create foods table + +Revision ID: 8a7c6b9d2e3f +Revises: 0001 +Create Date: 2023-05-25 16:32:45.123456 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.sql import func +from app.models import FoodCategory + +# revision identifiers, used by Alembic. +revision = '8a7c6b9d2e3f' +down_revision = '0001' +branch_labels = None +depends_on = None + +def upgrade(): + op.create_table( + 'foods', + sa.Column('id', UUID(as_uuid=True), primary_key=True, default=uuid.uuid4), + sa.Column('name', sa.String, nullable=False, unique=True), + sa.Column('description', sa.Text, nullable=True), + sa.Column('price', sa.Float, nullable=False), + sa.Column('category', sa.Enum(FoodCategory), nullable=False), + 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('foods') \ No newline at end of file