In trying to create better, more consistent conventions I wanted to get feedback on the following options. The scenarios I’m using involved recording whether an item is shipped to an existing address or a new one.
Both of these setups would get the point across, but are their additional pros and cons I’m not thinking of, or conventions on which is better?
field name: ship_to
option 1: new_address
option 2: existing_address
Pro:
- Allows for new options down the road if needed.
- Easier to grasp what's going on when looking just a the database
Cons:
- Not easier to grasp in the code - have to remember the options
field name: ship_to_new_address
option 1: true
option 2: false
Pros / Cons - Pretty much the opposite of what I listed above.
There is a third option:
ownercolumn linking back to your user/account table).ship_tocolumn that points to the address table with a foreign key.Pros:
The only con I can think of is that you’ll have to do more joins but joins aren’t really a bad thing. You may need a bit more sanity checking to make sure all the ownerships line up nicely but that’s not a big deal either.