"""composition_on_delete

Revision ID: 0020
Revises: 0019
Create Date: 2022-01-26 10:56:40.806211+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0020'
down_revision = '0019'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('composition_excluded_roles_composition_id_fkey', 'composition_excluded_roles', type_='foreignkey')
    op.create_foreign_key(None, 'composition_excluded_roles', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_excluded_scopes_composition_id_fkey', 'composition_excluded_scopes', type_='foreignkey')
    op.create_foreign_key(None, 'composition_excluded_scopes', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_excluded_staff_composition_id_fkey', 'composition_excluded_staff', type_='foreignkey')
    op.create_foreign_key(None, 'composition_excluded_staff', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_participants_composition_id_fkey', 'composition_participants', type_='foreignkey')
    op.create_foreign_key(None, 'composition_participants', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_roles_composition_id_fkey', 'composition_roles', type_='foreignkey')
    op.create_foreign_key(None, 'composition_roles', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_scopes_composition_id_fkey', 'composition_scopes', type_='foreignkey')
    op.create_foreign_key(None, 'composition_scopes', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint('composition_staff_composition_id_fkey', 'composition_staff', type_='foreignkey')
    op.create_foreign_key(None, 'composition_staff', 'composition', ['composition_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'composition_staff', type_='foreignkey')
    op.create_foreign_key('composition_staff_composition_id_fkey', 'composition_staff', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_scopes', type_='foreignkey')
    op.create_foreign_key('composition_scopes_composition_id_fkey', 'composition_scopes', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_roles', type_='foreignkey')
    op.create_foreign_key('composition_roles_composition_id_fkey', 'composition_roles', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_participants', type_='foreignkey')
    op.create_foreign_key('composition_participants_composition_id_fkey', 'composition_participants', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_excluded_staff', type_='foreignkey')
    op.create_foreign_key('composition_excluded_staff_composition_id_fkey', 'composition_excluded_staff', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_excluded_scopes', type_='foreignkey')
    op.create_foreign_key('composition_excluded_scopes_composition_id_fkey', 'composition_excluded_scopes', 'composition', ['composition_id'], ['id'])
    op.drop_constraint(None, 'composition_excluded_roles', type_='foreignkey')
    op.create_foreign_key('composition_excluded_roles_composition_id_fkey', 'composition_excluded_roles', 'composition', ['composition_id'], ['id'])
    # ### end Alembic commands ###
