"""empty message

Revision ID: 5b6468b682fc
Revises: 5877f671bb47
Create Date: 2019-05-19 09:18:22.210443

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5b6468b682fc'
down_revision = '5877f671bb47'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('consulta', sa.Column('b_cancelou', sa.Boolean(), nullable=True))
    op.add_column('consulta', sa.Column('b_chegou', sa.Boolean(), nullable=True))
    op.add_column('consulta', sa.Column('b_compareceu', sa.Boolean(), nullable=True))
    op.add_column('consulta', sa.Column('b_encaixe', sa.Boolean(), nullable=True))
    op.add_column('consulta', sa.Column('dt_cancelamento', sa.Date(), nullable=True))
    op.add_column('consulta', sa.Column('p_id_cancelou', sa.Integer(), nullable=True))
    op.add_column('consulta', sa.Column('p_id_chegou', sa.Integer(), nullable=True))
    op.add_column('consulta', sa.Column('p_id_compareceu', sa.Integer(), nullable=True))
    op.add_column('consulta', sa.Column('p_id_encaixe', sa.Integer(), nullable=True))
    op.add_column('consulta', sa.Column('p_id_quem_marcou', sa.Integer(), nullable=True))
    op.drop_constraint('consulta_profissional_id_fkey', 'consulta', type_='foreignkey')
    op.create_foreign_key(None, 'consulta', 'profissional', ['p_id_quem_marcou'], ['id'])
    op.create_foreign_key(None, 'consulta', 'profissional', ['p_id_chegou'], ['id'])
    op.create_foreign_key(None, 'consulta', 'profissional', ['p_id_encaixe'], ['id'])
    op.create_foreign_key(None, 'consulta', 'profissional', ['p_id_compareceu'], ['id'])
    op.create_foreign_key(None, 'consulta', 'profissional', ['p_id_cancelou'], ['id'])
    op.drop_column('consulta', 'em_consulta')
    op.drop_column('consulta', 'chegou')
    op.drop_column('consulta', 'encaixe')
    op.drop_column('consulta', 'compareceu')
    op.drop_column('consulta', 'profissional_id')
    op.drop_column('consulta', 'cancelou')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('consulta', sa.Column('cancelou', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.add_column('consulta', sa.Column('profissional_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('consulta', sa.Column('compareceu', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.add_column('consulta', sa.Column('encaixe', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.add_column('consulta', sa.Column('chegou', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.add_column('consulta', sa.Column('em_consulta', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'consulta', type_='foreignkey')
    op.drop_constraint(None, 'consulta', type_='foreignkey')
    op.drop_constraint(None, 'consulta', type_='foreignkey')
    op.drop_constraint(None, 'consulta', type_='foreignkey')
    op.drop_constraint(None, 'consulta', type_='foreignkey')
    op.create_foreign_key('consulta_profissional_id_fkey', 'consulta', 'profissional', ['profissional_id'], ['id'])
    op.drop_column('consulta', 'p_id_quem_marcou')
    op.drop_column('consulta', 'p_id_encaixe')
    op.drop_column('consulta', 'p_id_compareceu')
    op.drop_column('consulta', 'p_id_chegou')
    op.drop_column('consulta', 'p_id_cancelou')
    op.drop_column('consulta', 'dt_cancelamento')
    op.drop_column('consulta', 'b_encaixe')
    op.drop_column('consulta', 'b_compareceu')
    op.drop_column('consulta', 'b_chegou')
    op.drop_column('consulta', 'b_cancelou')
    # ### end Alembic commands ###
