"""order orderline

Revision ID: 2192034a345e
Revises: 5b2f96bda4de
Create Date: 2020-05-21 20:08:33.277088

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '2192034a345e'
down_revision = '5b2f96bda4de'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('orders',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('status', sa.Enum('NEW', 'COMPLETE', name='orderstatus'), nullable=True),
    sa.Column('billing_address1', sa.Text(), nullable=False),
    sa.Column('billing_address2', sa.Text(), nullable=True),
    sa.Column('billing_city', sa.String(length=60), nullable=False),
    sa.Column('billing_state', sa.String(length=60), nullable=False),
    sa.Column('billing_zip', sa.Integer(), nullable=False),
    sa.Column('shipping_address1', sa.Text(), nullable=False),
    sa.Column('shipping_address2', sa.Text(), nullable=True),
    sa.Column('shipping_city', sa.String(length=60), nullable=False),
    sa.Column('shipping_state', sa.String(length=60), nullable=False),
    sa.Column('shipping_zip', sa.Integer(), nullable=False),
    sa.Column('contact', sa.String(length=150), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('order_lines',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('quantity', sa.Integer(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('order_lines')
    op.drop_table('orders')
    # ### end Alembic commands ###
