"""add withdrawal reason

Revision ID: 378ee128c23f
Revises: 380d2c363481
Create Date: 2018-10-11 11:07:27.080104

"""
import model.utils
import sqlalchemy as sa
from alembic import op

from rdr_service.participant_enums import WithdrawalReason

# revision identifiers, used by Alembic.
revision = "378ee128c23f"
down_revision = "380d2c363481"
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()


def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("participant", sa.Column("withdrawal_reason", model.utils.Enum(WithdrawalReason), nullable=True))
    op.add_column("participant", sa.Column("withdrawal_reason_justification", sa.UnicodeText(), nullable=True))
    op.add_column(
        "participant_history", sa.Column("withdrawal_reason", model.utils.Enum(WithdrawalReason), nullable=True)
    )
    op.add_column("participant_history", sa.Column("withdrawal_reason_justification", sa.UnicodeText(), nullable=True))
    op.add_column(
        "participant_summary", sa.Column("withdrawal_reason", model.utils.Enum(WithdrawalReason), nullable=True)
    )
    op.add_column("participant_summary", sa.Column("withdrawal_reason_justification", sa.UnicodeText(), nullable=True))
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("participant_summary", "withdrawal_reason_justification")
    op.drop_column("participant_summary", "withdrawal_reason")
    op.drop_column("participant_history", "withdrawal_reason_justification")
    op.drop_column("participant_history", "withdrawal_reason")
    op.drop_column("participant", "withdrawal_reason_justification")
    op.drop_column("participant", "withdrawal_reason")
    # ### end Alembic commands ###


def upgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###
