38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""create foods table
|
|
|
|
Revision ID: 2f6c1d1f8f28
|
|
Revises: 8a7c6b9d2e3f
|
|
Create Date: 2023-04-26 15:32:07.987524
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import UUID, JSON
|
|
from sqlalchemy.sql import func
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2f6c1d1f8f28'
|
|
down_revision = '8a7c6b9d2e3f'
|
|
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.Text, nullable=True),
|
|
sa.Column('price', sa.Float, nullable=False),
|
|
sa.Column('is_available', sa.Boolean, default=True),
|
|
sa.Column('category', sa.String, nullable=True),
|
|
sa.Column('cuisine', sa.String, nullable=True),
|
|
sa.Column('allergens', JSON, nullable=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') |