"""empty message

Revision ID: aed0da0473c1
Revises: 859340b2ebb2
Create Date: 2021-02-26 16:56:26.022185

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'aed0da0473c1'
down_revision = '859340b2ebb2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('order_detail',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('main_order_id', sa.Integer(), nullable=True),
    sa.Column('menu_id', sa.Integer(), nullable=True),
    sa.Column('option_id', sa.Integer(), nullable=True),
    sa.Column('quantity', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['main_order_id'], ['main_order.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['menu_id'], ['menus.id'], ),
    sa.ForeignKeyConstraint(['option_id'], ['option.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('order_data')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('order_data',
    sa.Column('main_order_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('menu_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('option_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['main_order_id'], ['main_order.id'], name='order_data_main_order_id_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['menu_id'], ['menus.id'], name='order_data_menu_id_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['option_id'], ['option.id'], name='order_data_option_id_fkey', ondelete='CASCADE')
    )
    op.drop_table('order_detail')
    # ### end Alembic commands ###
