Syncing referential integrity tables and enums Syncing referential integrity tables and enums database database

Syncing referential integrity tables and enums


For fairly trivial stuff like this, I usually go with an enum. I can identify with you in the sense that I feel it's not completely right... but in my opinion it's the lesser of two evils.

Some additional justification for this: if for some reason a fourth value were to be added, your code would need updating anyway to be able to be able to handle that. While you're at it, it's very little trouble to also update the enum.


In the event that you need to add a new value to the table will this require a coding change in your application to support that new value? If so, make it an enum.


Depending on your database you could make the visibility field an enumerated type. That way the data would have to be one of the options you specified when created the table.