"""changed exam result and added question id to exam question

Revision ID: 81e62d12fac1
Revises: 3895aa356acf
Create Date: 2019-05-26 08:32:33.452443

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '81e62d12fac1'
down_revision = '3895aa356acf'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('exam_questions', sa.Column('question_id', sa.Integer(), nullable=True))
    op.create_index(op.f('ix_exam_questions_question_id'), 'exam_questions', ['question_id'], unique=False)

    with op.batch_alter_table("exam_result"):
        op.add_column('exam_result', sa.Column('practical_taken', sa.Boolean(), nullable=True))
        op.add_column('exam_result', sa.Column('theory_taken', sa.Boolean(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('exam_result', sa.Column('exam_end_date', sa.DATETIME(), nullable=True))
    op.drop_column('exam_result', 'theory_taken')
    op.drop_column('exam_result', 'practical_take')
    op.drop_index(op.f('ix_exam_questions_question_id'), table_name='exam_questions')
    op.drop_column('exam_questions', 'question_id')
    # ### end Alembic commands ###
