5 ms·
I have always, instinctively given an auto-generated unique ID to any table that represents an object: e.g. users, stories, payments etc. Although it can often
by sambeau 16y ago
I have always, instinctively given an auto-generated unique ID to any table that represents an object: e.g. users, stories, payments etc.
Although it can often mean that you end up giving a unique ID to pretty much everything it saves these kind of problems in the long run.
My other long-standing trick is to mark things as deleted rather than actually removing them from the database. This allows you to un-delete things. It has saved my ass on a few occasions.
- dglassan 16y agoSame here. I've been using an active indicator set to either 0 or 1 and I just query all the active rows