|
| 1 | +# Copyright (C) 2010-2015 Cuckoo Foundation. |
| 2 | +# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org |
| 3 | +# See the file 'docs/LICENSE' for copying permission. |
| 4 | + |
| 5 | +"""Add ON DELETE CASCADE to tasks_tags foreign keys |
| 6 | +
|
| 7 | +Revision ID: 4e000e02a409 |
| 8 | +Revises: c2bd0eb5e69d |
| 9 | +Create Date: 2025-04-11 09:58:42.957359 |
| 10 | +
|
| 11 | +""" |
| 12 | + |
| 13 | +# revision identifiers, used by Alembic. |
| 14 | +revision = '4e000e02a409' |
| 15 | +down_revision = 'c2bd0eb5e69d' |
| 16 | + |
| 17 | +from alembic import op |
| 18 | + |
| 19 | + |
| 20 | +def upgrade(): |
| 21 | + op.drop_constraint('tasks_tags_task_id_fkey', 'tasks_tags', type_='foreignkey') |
| 22 | + op.create_foreign_key('tasks_tags_task_id_fkey', 'tasks_tags', 'tasks', ['task_id'], ['id'], ondelete='CASCADE') |
| 23 | + |
| 24 | + op.drop_constraint('tasks_tags_tag_id_fkey', 'tasks_tags', type_='foreignkey') |
| 25 | + op.create_foreign_key('tasks_tags_tag_id_fkey', 'tasks_tags', 'tags', ['tag_id'], ['id'], ondelete='CASCADE') |
| 26 | + |
| 27 | + |
| 28 | +def downgrade(): |
| 29 | + op.drop_constraint('tasks_tags_task_id_fkey', 'tasks_tags', type_='foreignkey') |
| 30 | + op.create_foreign_key('tasks_tags_task_id_fkey', 'tasks_tags', 'tasks', ['task_id'], ['id']) |
| 31 | + |
| 32 | + op.drop_constraint('tasks_tags_tag_id_fkey', 'tasks_tags', type_='foreignkey') |
| 33 | + op.create_foreign_key('tasks_tags_tag_id_fkey', 'tasks_tags', 'tags', ['tag_id'], ['id']) |
0 commit comments