"""empty message

Revision ID: 150016d49dda
Revises: cab67edb0c8f
Create Date: 2021-10-17 12:04:55.057318

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '150016d49dda'
down_revision = 'cab67edb0c8f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('order',
    sa.Column('id', sa.String(), nullable=False),
    sa.Column('customer', sa.String(), nullable=False),
    sa.Column('address_id', sa.Integer(), nullable=False),
    sa.Column('amount', sa.Integer(), nullable=False),
    sa.Column('payment_completed', sa.Integer(), nullable=False),
    sa.Column('completed', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['address_id'], ['address.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['customer'], ['customer.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('order_item',
    sa.Column('order_id', sa.String(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=False),
    sa.Column('quantity', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['order_id'], ['order.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('order_id', 'product_id')
    )
    op.create_unique_constraint(None, 'cart_item', ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'cart_item', type_='unique')
    op.drop_table('order_item')
    op.drop_table('order')
    # ### end Alembic commands ###
