Perhaps have a
_deleted_users table (and others) and use a procedure to move the rows like so (not tested code):
DELIMITER $$ CREATE PROCEDURE safeDelete( IN id_in INT ) BEGIN INSERT INTO _deleted_users (<columns>) VALUES (SELECT * FROM _users WHERE id = id_in); DELETE FROM _users WHERE id = id_in; END $$ DELIMITER ;
You could then just call it like so:
CALL safeDelete(1); /* where 1 is their ID (Primary Key) */
restore() procedure to move them all back.
Jaquarh posted this
Have an answer?