Re:Declarative Schemas for simpler database management
by efxhoy on Thursday April 03, 2025 @06:11PM
(#43576089)
There's nothing wrong with nullable fields when it's appropriate. When kids are born they don't have names. Not all users want to tell you their names. A null value is data too.
Re:Declarative Schemas for simpler database management
by MrMcCall on Thursday April 03, 2025 @06:33PM
(#43576277)
> when it's appropriate
Yes, it just requires extra care when querying and handling the rows.
It's always just easier, if you can, to make it NOT NULL after prepopulating all rows' columns to the empty string (or real data).
Sometimes NULL is truly different than the empty string, but that, like you said, is just a kind of data.
Of course, some dbs (SQLServer?) infer NULL from the empty string, or am I misremembering?
Always having the columns be NOT NULL is a fundamental cheat, after always having a PK, or is that too old school for 2025?