Social network database

-1

I have a question, it is in the reactions that are made to the publication and to the usuarios - contactos :

Design a relational database that includes the following:

  

* User storage (full name, date of birth, email, phone numbers, description, studies, place of residence, place of work)

     

* User contacts (including date of aggregation / contact acceptance)

     

* Contacts can publish information on the pages of other users, if that user has open publication permission, in case the publication is allowed, the contact that publishes must be saved, to whom it is published, the content and the date of publication.

     

* Users can indicate a status (like, surprise, annoy, not like) to the publications of the pages of their contacts.

     

Your database must be modeled respecting the database design theory, and you must validate the fields.

    
asked by Anthony Stark 14.03.2017 в 06:01
source

1 answer

0

This is not meant to be a complete answer, but your data schema should be there:

User table

id (PK)  nombre | fechanacimiento | correo | teléfonos | descripción | estudios | residencia | trabajo

Contacts table

id (PK) | id_contacto1 (FK contacto.id) | id_contacto2 (FC contacto.id | fecha | permiso_publicacion

Here I have defined that "permission_publication" is the mutual permission given by users to publish each one on the page of the other.

Publications table

id (PK) | id_dueño_pagina (FK contacto.id) | id_publicador (FC contacto.id) | contenido | fecha

Reactions table

id (PK) | id_publicacion (FK publicaciones.id) | id_usuario (FP usuario.id | reaccion

Regarding the specific rule:

  

Contacts can post information on other pages   users, if that user has open publishing permission

That has nothing relational. It is done with business logic in the application layer. It can be implemented with a CHECK, but without knowing if the DB supports it, it is silly and is beyond the scope of the question.

    
answered by 14.03.2017 в 09:53