4 ms·
> For example, it's impossible to know whether a timestamp is the authority on an entity's state by looking at a table structure This is just a matter of conve
by nightpool 4y ago
> For example, it's impossible to know whether a timestamp is the authority on an entity's state by looking at a table structure
This is just a matter of convention—if your codebase is consistent about it and there's no other option for "is this record deleted?", then yes it will be absolutely clear that "deleted_at" is the right column to use.
What's actually worse for making the database structure clear is to have "vestigial" columns that store old data, like you proposed for "deleted" and "deleted_at". Now, if they disagree, which one should you trust? Maybe some code is using one, while some code is using the other. Having a single source-of-truth column—no matter what the name is—is always going to be better then having two columns that could get out of sync or disagree.