Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

trigger for DELETE prevention #6

@ghazel

Description

@ghazel

Since DELETE cannot be propagated during a migration, I think it would be neat to throw an error when a DELETE is attempted. Something like:

CREATE TRIGGER mytable_delete_block BEFORE DELETE ON mytable FOR EACH ROW SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETE is not allowed during a migration';

Then afterwards:

DROP TRIGGER mytable_delete_block;

The SIGNAL command is only valid on on MySQL >= 5.5, but there are a number of hacks which would work on >= 5.0 ( http://stackoverflow.com/questions/229765/triggers-that-cause-inserts-to-fail-possible ).

I'm probably going to go implement this, but I wanted to file a ticket about it in case there were thoughts or feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions