<gh_stars>0
"""Add ONDELETE clause to Message

Revision ID: 62fa184e02fb
Revises: 02923f056907
Create Date: 2021-12-05 21:47:05.790016

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('message_ibfk_1', 'message', type_='foreignkey')
    op.create_foreign_key(None, 'message', 'chat', ['chat_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'message', type_='foreignkey')
    op.create_foreign_key('message_ibfk_1', 'message', 'chat', ['chat_id'], ['id'])
    # ### end Alembic commands ###
