"""Re-establishes the foreign key between vulnerability_resources and the vulnerability table.

Revision ID: d694cd137157
Revises: c10e1faccb1c
Create Date: 2020-10-13 20:58:13.244989

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "d694cd137157"
down_revision = "c10e1faccb1c"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "vulnerability_resources",
        sa.Column("vulnerability_details_id", sa.Integer(), nullable=True),
    )
    op.create_foreign_key(
        None,
        "vulnerability_resources",
        "vulnerability",
        ["vulnerability_details_id"],
        ["id"],
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "vulnerability_resources", type_="foreignkey")
    op.drop_column("vulnerability_resources", "vulnerability_details_id")
    # ### end Alembic commands ###
