"""create challenges

Revision ID: db218c826aed
Revises: b556f5c0eed4
Create Date: 2019-10-27 18:41:35.561594

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'db218c826aed'
down_revision = 'b556f5c0eed4'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('recipe', schema=None) as batch_op:
        batch_op.add_column(sa.Column('challenge_id', sa.Integer(), nullable=True))
        batch_op.create_foreign_key(batch_op.f('fk_recipe_challenge_id_challenge'), 'challenge', ['challenge_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('recipe', schema=None) as batch_op:
        batch_op.drop_constraint(batch_op.f('fk_recipe_challenge_id_challenge'), type_='foreignkey')
        batch_op.drop_column('challenge_id')

    # ### end Alembic commands ###
