diff --git a/alembic/versions/20250328_083719_3749e3d6_create_meal.py b/alembic/versions/20250328_083719_3749e3d6_create_meal.py new file mode 100644 index 0000000..7698e1a --- /dev/null +++ b/alembic/versions/20250328_083719_3749e3d6_create_meal.py @@ -0,0 +1,34 @@ +"""create meals table + +Revision ID: 2c8d9938e6a4 +Revises: 0001 +Create Date: 2023-05-18 15:22:41.592728 + +""" +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 = '2c8d9938e6a4' +down_revision = '0001' +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + 'meals', + sa.Column('id', UUID(as_uuid=True), primary_key=True, nullable=False, default=uuid.uuid4), + sa.Column('name', sa.String, nullable=False), + sa.Column('description', sa.String, nullable=True), + sa.Column('price', sa.Float, nullable=False), + sa.Column('category_id', UUID(as_uuid=True), nullable=False), + sa.Column('created_at', sa.DateTime, nullable=False, server_default=func.now()), + sa.Column('updated_at', sa.DateTime, nullable=False, server_default=func.now(), onupdate=func.now()), + ) + + +def downgrade(): + op.drop_table('meals') \ No newline at end of file