Just Create a Relation
I recently read You might as well timestamp it and today I came across an equal truism
Just create a relation.
Many a time have i seen tables of a given object where the table has a status field and a status_changed timestamp.
But guess what; knowing when a status changed, what caused it AND WHAT THE PREVIOUS STATUS WAS happens quite a lot.
So whenever I write a field called status, state or something similar I always default to making it a relation.
So instead of post table like idtitlestatusstatus_changed_atbodysome idsome titlesome statustimestampbody I opt for two tables idtitlebodysome idsome titlebody and post_idstatuscreated_atcreated_bysome idsome statustimestampuser_id The current status is always the last entry (ordered by created_at) in that table for that given id.