2 ms·
I've had experience with the soft delete in laravel and I'm not fond of it. Because we had a separate dashboard with manual SQL reports without an ORM to magica
by dsego 6y ago
I've had experience with the soft delete in laravel and I'm not fond of it. Because we had a separate dashboard with manual SQL reports without an ORM to magically filter out all the deleted_at rows. And it gets tedious to remember to filter out the rows with deleted_at timestamps.
I would like to see the soft-delete implemented differently, say a second trashcan table for each active table, e.g. users_archive, and the delete operation would move the row there.
- sdfhbdf 6y agoOr you could have views with `deleted_at` filtered out: https://learnsql.com/blog/sql-view/ https://learnsql.com/blog/sql-view/
- dsego 6y agoOh, good point. Maybe this could be built into ORMs.
- jchw 6y agoThe reason why deleted_at is probably done this way is due to foreign key constraints. Especially for a users table, there are probably a whole lot of things that point to the user's table. A cascading deletion could wipe out quite a bit of unintended data.