Hi everyone,
I'm facing a database design problem.
I want to make a sort of networking solution for the clients of my site in which they would be able to share or keep private some of their contact information.
so if i have a table like this:
i would like to be able to set some of the columns as having different privacy levels.
The problem is that as far as i know, there is no possibility to put metadata to a column like:
note that i dont want it to be permanent, i want to let the user decide which privacy levels give to any personal acount information (except for password...).
My first approach to solve this, was to make a big table, with the columns names, field values and privacy levels like this :
whenever a user sets a different privacy setting than the default, the name of the column and the field value would be stored in this privacy levels table with the desired privacy.
However this approach has a lot lot lot of overhead. and would make the table very large and slow to query.
Then i thought of another approach which was to give the users_retailers _account_info column a privacy_level pair column like this:
so when a user requests to get info from a certain retailer, the application would query all the table fields and only show those whose privacy is set to public. but I don't know if this is the right approach.
If you have any suggestions, please let me know.
Thank you for reading this far,
best regards
bilibytes
I'm facing a database design problem.
I want to make a sort of networking solution for the clients of my site in which they would be able to share or keep private some of their contact information.
so if i have a table like this:
Code:
CREATE TABLE `users_retailers_account_info` ( `id` bigint(15) unsigned NOT NULL auto_increment, `email` varchar(255) NOT NULL default 'N/A', `password` varchar(255) NOT NULL default 'N/A', `name_first_owner` varchar(255) NOT NULL default 'N/A', `name_second_owner` varchar(255) NOT NULL default 'N/A', `company_name` varchar(255) NOT NULL default 'N/A', `country_id` mediumint(8) NOT NULL default 'N/A', `city_id` varchar(255) NOT NULL default 'N/A', `street_address` varchar(255) NOT NULL default 'N/A', `lang_iso` varchar(5) NOT NULL default 'en', PRIMARY KEY (`id`) )
The problem is that as far as i know, there is no possibility to put metadata to a column like:
Code:
[public] street_address | 4th avenue, Manhatan [protected] email | johnleehooker@hotmail.com
My first approach to solve this, was to make a big table, with the columns names, field values and privacy levels like this :
Code:
CREATE TABLE `privacy_levels` ( `id` bigint(15) NOT NULL auto_increment, `user_id` bigint(15) NOT NULL auto_increment, `column_name` varchar(255) NOT NULL default 'N/A', `field_value` varchar(255) NOT NULL default 'N/A', `privacy_level` varchar(20) NOT NULL default 'private', PRIMARY KEY (`id`) )
However this approach has a lot lot lot of overhead. and would make the table very large and slow to query.
Then i thought of another approach which was to give the users_retailers _account_info column a privacy_level pair column like this:
Code:
CREATE TABLE `users_retailers_account_info` ( `id` bigint(15) unsigned NOT NULL auto_increment, `email` varchar(255) NOT NULL default 'N/A', [B] `privacy_email` [/B]varchar(20) NOT NULL default 'private', `password` varchar(255) NOT NULL default 'N/A', `name_first_owner` varchar(255) NOT NULL default 'N/A', [B] `privacy_nfo` [/B]varchar(20) NOT NULL default 'private', `name_second_owner` varchar(255) NOT NULL default 'N/A', [B] `privacy_nso`[/B] varchar(20) NOT NULL default 'private', `company_name` varchar(255) NOT NULL default 'N/A', [B]`privacy_company` [/B]varchar(20) NOT NULL default 'private', `country_id` mediumint(8) NOT NULL default 'N/A', `city_id` varchar(255) NOT NULL default 'N/A', `street_address` varchar(255) NOT NULL default 'N/A', [B] `privacy_street_address`[/B] varchar(20) NOT NULL default 'private', `lang_iso` varchar(5) NOT NULL default 'en', PRIMARY KEY (`id`) )
If you have any suggestions, please let me know.
Thank you for reading this far,
best regards
bilibytes
Comment