"""Added cascading for deleting cgac

Revision ID: 40f1074309d4
Revises: 26cfc98728c8
Create Date: 2017-02-16 11:53:48.764917

"""

# revision identifiers, used by Alembic.
revision = '40f1074309d4'
down_revision = '26cfc98728c8'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_sub_tier_agency_cgac', 'sub_tier_agency', type_='foreignkey')
    op.create_foreign_key('fk_sub_tier_agency_cgac', 'sub_tier_agency', 'cgac', ['cgac_id'], ['cgac_id'], ondelete='CASCADE')
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_sub_tier_agency_cgac', 'sub_tier_agency', type_='foreignkey')
    op.create_foreign_key('fk_sub_tier_agency_cgac', 'sub_tier_agency', 'cgac', ['cgac_id'], ['cgac_id'])
    ### end Alembic commands ###

