"""user_requests events on update cascade

Revision ID: 8797e9a71f62
Revises: 85068c55138a
Create Date: 2017-02-13 15:48:25.344003

"""

# revision identifiers, used by Alembic.
revision = '8797e9a71f62'
down_revision = '85068c55138a'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('events_user_guid_fkey', 'events', type_='foreignkey')
    op.create_foreign_key(None, 'events', 'users', ['user_guid', 'auth_user_type'], ['guid', 'auth_user_type'], onupdate='CASCADE')
    op.drop_constraint('user_requests_user_guid_fkey', 'user_requests', type_='foreignkey')
    op.create_foreign_key(None, 'user_requests', 'users', ['user_guid', 'auth_user_type'], ['guid', 'auth_user_type'], onupdate='CASCADE')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'user_requests', type_='foreignkey')
    op.create_foreign_key('user_requests_user_guid_fkey', 'user_requests', 'users', ['user_guid', 'auth_user_type'], ['guid', 'auth_user_type'])
    op.drop_constraint(None, 'events', type_='foreignkey')
    op.create_foreign_key('events_user_guid_fkey', 'events', 'users', ['user_guid', 'auth_user_type'], ['guid', 'auth_user_type'])
    ### end Alembic commands ###

add migration