bety
bety copied to clipboard
users value constraints: needed cleanup and decisions
area
- [ ] Decide on constraints
- [ ] Add to migration
salt
- [ ] Eliminate NULLs
- [ ] Add not null constraint
remember_token, remember_token_expires_at
- [ ] Decide what to do with these columns
state_prov, postal_code
- [ ] Decide if any constraints beyond not NULL and whitespace-normalized apply
- [ ] If so, add them
Details
area
This column currently isn't very meaningful. We have a mixture of values like "tundra" with values like "Agriculture" and "Industry".
salt
As mentioned in GH #205, 2 rows have NULL in the salt column.
remember_token, remember_token_expires_at
Both of these columns are always null.
state_prov, postal_code
Since these vary so much from country to country, it seems doubtful we can come up with any meaningful constraints that apply to all countries.
We could, however, have checks for certain countries. For example, something like CHECK (postal_code ~ '^([0-9]{5}(-[0-9]{4})?)?')
OR country != 'United States')`. A more complicated constraint that might cover a number of countries could be written using a function. Is this worthwhile?