2 ms·
The deleted records table he mentions at the end is a good approach, but: 1. This can easily be done with a trigger, so that you just call a DELETE on the tabl
by hn_throwaway_99 4y ago
The deleted records table he mentions at the end is a good approach, but:
1. This can easily be done with a trigger, so that you just call a DELETE on the table and deleted tables are copied to the deletion table automatically.
2. I prefer, instead of having a jsonb column, that each table has a corresponding `deleted_original_table_name` table that exactly matches the schema of the base table, with the addition that the first column is a `deleted_at` timestamp. It's easy to use helper methods in schema migrations to always keep the table definitions in sync.