"""Makes vulnerability_resources FK non-nullable.

Revision ID: 4c879a183a73
Revises: d694cd137157
Create Date: 2020-10-16 07:28:50.893030

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # Make sure the FK on vulnerability_resources can never be null.
    op.alter_column(
        "vulnerability_resources",
        "vulnerability_details_id",
        existing_type=sa.Integer(),
        nullable=False,
    )


def downgrade():
    op.alter_column(
        "vulnerability_resources",
        "vulnerability_details_id",
        existing_type=sa.Integer(),
        nullable=True,
    )
