34 lines
972 B
Python
34 lines
972 B
Python
"""create foods table
|
|
|
|
Revision ID: 1d8f6e7c0329
|
|
Revises: 6d7a3c2b1f5a
|
|
Create Date: 2023-05-10 15:24:57.821405
|
|
|
|
"""
|
|
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 = '1d8f6e7c0329'
|
|
down_revision = '6d7a3c2b1f5a'
|
|
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.String, nullable=True),
|
|
sa.Column('price', sa.Float, nullable=False),
|
|
sa.Column('restaurant_id', UUID(as_uuid=True), nullable=False),
|
|
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') |