bossy-restaurant-2uye8v/alembic/versions/20250328_083719_3749e3d6_create_meal.py
2025-03-28 08:37:31 +00:00

34 lines
1007 B
Python

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