"""empty message

Revision ID: 6deaf8206030
Revises: ab7015bd1fd0
Create Date: 2018-08-01 23:16:30.458137

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '6deaf8206030'
down_revision = 'ab7015bd1fd0'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cab_deal',
    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('booking_id', sa.Integer(), nullable=True),
    sa.Column('website_id', sa.Integer(), nullable=True),
    sa.Column('slab', sa.Integer(), nullable=True),
    sa.Column('driver_night_allowance_charge', sa.DECIMAL(), nullable=True),
    sa.Column('car_night_allowance_charge', sa.DECIMAL(), nullable=True),
    sa.Column('total_hours', sa.Integer(), nullable=True),
    sa.Column('base_fare', sa.DECIMAL(), nullable=True),
    sa.Column('base_fare_weekend', sa.DECIMAL(), nullable=True),
    sa.Column('base_fare_peak_season', sa.DECIMAL(), nullable=True),
    sa.Column('base_fare_with_fuel', sa.DECIMAL(), nullable=True),
    sa.Column('different_pickup_drop_point_charge', sa.DECIMAL(), nullable=True),
    sa.Column('km_restriction', sa.DECIMAL(), nullable=True),
    sa.Column('fare_exceeded_per_hr', sa.DECIMAL(), nullable=True),
    sa.Column('fare_exceeded_per_km', sa.DECIMAL(), nullable=True),
    sa.Column('initial_km', sa.Integer(), nullable=True),
    sa.Column('initial_km_fare', sa.DECIMAL(), nullable=True),
    sa.Column('cancellation_charges', sa.DECIMAL(), nullable=True),
    sa.Column('distance', sa.DECIMAL(), nullable=True),
    sa.Column('total_fare', sa.DECIMAL(), nullable=True),
    sa.ForeignKeyConstraint(['booking_id'], ['cab_booking.id'], ),
    sa.ForeignKeyConstraint(['website_id'], ['cab_website.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cab_deal_id'), 'cab_deal', ['id'], unique=False)
    op.add_column('cab_tax', sa.Column('deal_id', sa.Integer(), nullable=True))
    op.create_unique_constraint(None, 'cab_tax', ['deal_id'])
    op.drop_constraint('cab_tax_invoice_id_fkey', 'cab_tax', type_='foreignkey')
    op.create_foreign_key(None, 'cab_tax', 'cab_deal', ['deal_id'], ['id'])
    op.drop_column('cab_tax', 'invoice_id')
    op.drop_table('cab_invoice')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cab_tax', sa.Column('invoice_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'cab_tax', type_='foreignkey')
    op.create_foreign_key('cab_tax_invoice_id_fkey', 'cab_tax', 'cab_invoice', ['invoice_id'], ['id'])
    op.drop_constraint(None, 'cab_tax', type_='unique')
    op.drop_column('cab_tax', 'deal_id')
    op.create_table('cab_invoice',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('updated_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('booking_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('website_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('slab', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('driver_night_allowance_charge', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('car_night_allowance_charge', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('total_hours', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('base_fare', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('base_fare_weekend', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('base_fare_peak_season', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('base_fare_with_fuel', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('different_pickup_drop_point_charge', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('km_restriction', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('fare_exceeded_per_hr', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('fare_exceeded_per_km', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('initial_km', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('initial_km_fare', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('cancellation_charges', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('distance', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('total_fare', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['booking_id'], ['cab_booking.id'], name='cab_invoice_booking_id_fkey'),
    sa.ForeignKeyConstraint(['website_id'], ['cab_website.id'], name='cab_invoice_website_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='cab_invoice_pkey')
    )
    op.drop_index(op.f('ix_cab_deal_id'), table_name='cab_deal')
    op.drop_table('cab_deal')
    # ### end Alembic commands ###
