<reponame>pombredanne/vulncode-db<filename>migrations/versions/d694cd137157_re_establishes_the_foreign_key_between_.py<gh_stars>100-1000
"""Re-establishes the foreign key between vulnerability_resources and the vulnerability table.

Revision ID: <KEY>
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 = "<KEY>"
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 ###

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

Revision ID: <KEY>
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 = "<KEY>"
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 ###
Re-establishes the foreign key between vulnerability_resources and the vulnerability table.  Revision ID: <KEY> Revises: c10e1faccb1c Create Date: 2020-10-13 20:58:13.244989 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###