3 ms·
Here's my insanity Give the table an DeletedTimestamp and DeleatedReason column. Mark the records as deleted. Run around like a lunatic and fix queries so th
by benjohnson 6y ago
Here's my insanity
Give the table an DeletedTimestamp and DeleatedReason column.
Mark the records as deleted.
Run around like a lunatic and fix queries so they don't show "deleted" columns to the rest of the app.
Make a page in the application where people can "restore" deleted items. Because they do stupid things too once in a while.
- niccl 6y agoMy fix for this is to rename the table to something like _b_<table_name> then create a view <table_name> that excludes the 'deleted' values (based on the value in DeletedReason column). That way you make one change to the structure when you create the column, and everything else Just Works
- munk-a 6y agoWe use the same approach and specifically use a "...withdeleted" suffix for the table - you got a table of containing widget objects there? how about a "widgetwithdeleted" table.
- ptman 6y agountil you hit requirements that data must really be gone from the system at least you need something like DELETE FROM foo WHERE deleted < NOW() - '30 days'::timedelta (or whatever the correct syntax is)