One very old database maintenance rule basically says:
No entry should by removed from a database, but just marked as deleted.
|--unknown author|| |
According to this rule, we may want to implement similar functionality also in
phpMyEdit and it is possible, of course.
First of all we need to set-up phpMyEdit to list only valid non-deleted records.
This can be accomplished using
configuration option. We suppose that we have table where a column named
deleted indicates if record is deleted or not.
Example 6-3. Non-deleted records listing
$opts['filters'] = 'deleted IS NULL OR deleted = 0';
Than we have to create a "delete before" trigger and we are done. Trigger PHP code
should look similar to this example:
Example 6-4. Trigger for marking records as deleted
$query2 = sprintf('UPDATE %s SET deleted = 1 WHERE id = %d',
To recover a particular record just change the value in the
using your SQL client or interface (for example using