"""Make session parent logical id "delete cascade"

Revision ID: faf0174f2569
Revises: 28c2f1c6aa15
Create Date: 2018-04-12 09:55:54.585602

"""

# revision identifiers, used by Alembic.
revision = 'faf0174f2569'
down_revision = '28c2f1c6aa15'

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('session_parent_logical_id_fkey', 'session', type_='foreignkey')
    op.create_foreign_key(None, 'session', 'session', ['parent_logical_id'], ['logical_id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'session', type_='foreignkey')
    op.create_foreign_key('session_parent_logical_id_fkey', 'session', 'session', ['parent_logical_id'], ['logical_id'])
    # ### end Alembic commands ###
