I have a users table with the following fields:
USER
--------
userID
email
age
gender
aboutme
homephone
cellphone
address
etc..
i want the user to have the option to either display or hide the content, facebook like, where the users controls what to display. what would be the best design for this?
examples:
1.add an additional column for each option(boolean), this might be bad because if i want to add future items, the table would get long
USER
-----
userID
email
isemailPrivate
age
isagePrivate
gender
aboutme
homephone
ishomephoneprivate
cellphone
address
etc..
2.add a privacy table which controls the privacy for each user
userprivacy
-----------
userprivacyId
userId (fk)
emailprivacy
ageprivacy
homephoneprivacy
etc...
is there a better way of doing this, if so, can you please give me a rough schema or any tips on how to do it :) thank you
First off, you definitely do not want to add those flags in the user table. You will need a different table for that.
Your second example is actually really close to the best solution. Depending on the overall complexity of your project, you might actually want these settings broken up even further, depending on their type.
However, as long as you only need flags to determine in every type of info is private or not, independently, I believe your second example is appropriate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With