2 ms·
-1: mark-for-deletion is generally best practice, where it doesn't create meaningful overhead in storage or performance. To optimize performance, consider a mov
by asah 2y ago
-1: mark-for-deletion is generally best practice, where it doesn't create meaningful overhead in storage or performance. To optimize performance, consider a move-type operation, so expensive operations don't need to scan deleted data, but it's still online for the purposes of fast restore/recovery.
Conceptually, database backup/restore is effectively mark-for-deletion, but with a more difficult path to restoration, especially for one complex object.
If your database or framework/ORM supports it, my favorite solution is to use virtual tables that hide deleted data, so every the code is kept clean and developers don't accidentally query dead data.
I'd love to see an ORM with full undo/redo support. Examples:
https://github.com/zchtodd/Flask-UndoRedo https://github.com/zchtodd/Flask-UndoRedo
https://github.com/etianen/django-reversion https://github.com/etianen/django-reversion