"""Adding consent_for_cabor

Revision ID: 19687c270db8
Revises: d3bcbe963bf0
Create Date: 2017-05-31 10:42:22.868438

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

from rdr_service.participant_enums import QuestionnaireStatus

# revision identifiers, used by Alembic.
revision = "19687c270db8"
down_revision = "d3bcbe963bf0"
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_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 ###


def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "participant_summary", sa.Column("consent_for_cabor", model.utils.Enum(QuestionnaireStatus), nullable=True)
    )
    op.add_column("participant_summary", sa.Column("consent_for_cabor_time", model.utils.UTCDateTime(), nullable=True))
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("participant_summary", "consent_for_cabor_time")
    op.drop_column("participant_summary", "consent_for_cabor")
    # ### end Alembic commands ###
