Add migration for Meal

This commit is contained in:
Backend IM Bot 2025-03-28 08:37:31 +00:00
parent 8f36477fff
commit 060c7ca0b2

View File

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