"""empty message

Revision ID: a1bee80df33d
Revises: 57469fc189cb
Create Date: 2018-08-14 14:01:02.724660

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a1bee80df33d'
down_revision = '57469fc189cb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cab_user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('phone', sa.String(), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('phone')
    )
    op.create_index(op.f('ix_cab_user_id'), 'cab_user', ['id'], unique=False)
    op.add_column('cab_booking', sa.Column('cab_id', sa.Integer(), nullable=True))
    op.add_column('cab_booking', sa.Column('deal_id', sa.Integer(), nullable=True))
    op.add_column('cab_booking', sa.Column('user_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'cab_booking', 'cab_deal', ['deal_id'], ['id'])
    op.create_foreign_key(None, 'cab_booking', 'cab', ['cab_id'], ['id'])
    op.create_foreign_key(None, 'cab_booking', 'cab_user', ['user_id'], ['id'])
    op.drop_column('cab_booking', 'outstation')
    op.drop_column('cab_booking', 'one_way')
    op.add_column('cab_deal', sa.Column('one_way', sa.Boolean(), nullable=True))
    op.add_column('cab_deal', sa.Column('outstation', sa.Boolean(), nullable=True))
    op.drop_constraint('cab_deal_booking_id_fkey', 'cab_deal', type_='foreignkey')
    op.drop_column('cab_deal', 'booking_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cab_deal', sa.Column('booking_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key('cab_deal_booking_id_fkey', 'cab_deal', 'cab_booking', ['booking_id'], ['id'])
    op.drop_column('cab_deal', 'outstation')
    op.drop_column('cab_deal', 'one_way')
    op.add_column('cab_booking', sa.Column('one_way', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.add_column('cab_booking', sa.Column('outstation', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'cab_booking', type_='foreignkey')
    op.drop_constraint(None, 'cab_booking', type_='foreignkey')
    op.drop_constraint(None, 'cab_booking', type_='foreignkey')
    op.drop_column('cab_booking', 'user_id')
    op.drop_column('cab_booking', 'deal_id')
    op.drop_column('cab_booking', 'cab_id')
    op.drop_index(op.f('ix_cab_user_id'), table_name='cab_user')
    op.drop_table('cab_user')
    # ### end Alembic commands ###
