Add migration for Food
This commit is contained in:
parent
b938114f33
commit
7ce496de56
34
alembic/versions/20250328_160053_2d6f8e66_create_food.py
Normal file
34
alembic/versions/20250328_160053_2d6f8e66_create_food.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"""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')
|
Loading…
x
Reference in New Issue
Block a user