1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] DB Design: how to indicate if a column data is public or private

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 3, 2024 às 17:52.

  1. Stack

    Stack Membro Participativo

    I'm designing a database and I have a question about how to make private some user data.

    I have a user table, with name, city, birthday, biography, etc. And the user can make some data private (other users can see that data).

    First, I thought to add columns to the table to indicate if a column is private or not. For example:

    User
    -------

    user_id | name | city | cityIsPrivate | birthday | birthdayIsPrivate
    ---------+------+------+---------------+----------+------------------


    Or, another approach is to add a varchar column to indicate which columns are private:

    User
    -------

    user_id | name | city | birthday | privateColumns
    ---------+------+------+----------+---------------


    And this privateColumns will have this: "city:NO; birthday:YES".

    The user table will only have three columns that can be private or public. I will only have to add three columns more to the table.

    Any advice?

    Continue reading...

Compartilhe esta Página