<filename>migrations/versions/31017c81dabb_cascade_delete_for_graph_successors.py
"""cascade delete for graph successors

Revision ID: <KEY>
Revises: 1ef9183650cc
Create Date: 2019-12-17 10:44:32.301456

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '1ef9183650cc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('links_to_id_fkey', 'links', type_='foreignkey')
    op.create_foreign_key(None, 'links', 'pages', ['to_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'links', type_='foreignkey')
    op.create_foreign_key('links_to_id_fkey', 'links', 'pages', ['to_id'], ['id'])
    # ### end Alembic commands ###

<filename>migrations/versions/31017c81dabb_cascade_delete_for_graph_successors.py
"""cascade delete for graph successors

Revision ID: <KEY>
Revises: 1ef9183650cc
Create Date: 2019-12-17 10:44:32.301456

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '1ef9183650cc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('links_to_id_fkey', 'links', type_='foreignkey')
    op.create_foreign_key(None, 'links', 'pages', ['to_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'links', type_='foreignkey')
    op.create_foreign_key('links_to_id_fkey', 'links', 'pages', ['to_id'], ['id'])
    # ### end Alembic commands ###

cascade delete for graph successors  Revision ID: <KEY> Revises: 1ef9183650cc Create Date: 2019-12-17 10:44:32.301456 # 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 ###