---
# System prepended metadata

title: UML Bolivia Solidaria
tags: [bolivia-solidaria, UML, web-dev, db]

---

###### tags: `web-dev` `db` `UML` `bolivia-solidaria`

UML Bolivia Solidaria 
======================

Gitlab username : [username Gitlab PATRICIA](https://gitlab.com/mamanipatricia)

## Steps

1. Create Database
```sql=
create database bolivia_solidaria
```
2. optional, if you use:
- mysql 
```sql=
use bolivia_solidaria
```
- postgres 
```sql=
\c bolivia_solidaria
c = connect
```
3. Create tables

### rol
```sql=
CREATE TABLE rol (
    id INT PRIMARY KEY,
    name VARCHAR(50)
);
```
### user
```sql=
CREATE TABLE user (
    id INT PRIMARY KEY,
    name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50),
    email VARCHAR(50) NOT NULL,
    cellphone VARCHAR(15) NOT NULL,
    city VARCHAR(20)
);
```
### rol_user
```sql=
CREATE TABLE rol_user (
    id INT PRIMARY KEY,
    id_user INT NOT NULL,
    id_rol INT NOT NULL,
    date_assigned date NOT NULL,
    _user VARCHAR(20) NOT NULL,
    FOREIGN KEY (id_user)REFERENCES user(id),
    FOREIGN KEY (id_rol) REFERENCES rol(id)
);
```

### post

```sql=
CREATE TABLE post (
    id INT PRIMARY KEY,
    title VARCHAR(250) NOT NULL,
    content TEXT NOT NULL,
    date DATE NOT NULL,
    category VARCHAR(50),
    status ENUM('wrote', 'checked', 'published'),
    id_user INT NOT NULL,
    FOREIGN KEY (id_user) REFERENCES user(id)
);
```
### comment
```sql=
CREATE TABLE comment (
    id INT PRIMARY KEY,
    content TEXT NOT NULL,
    date DATE NOT NULL,
    name_author VARCHAR(100) NOT NULL,
    email_author VARCHAR(100) NOT NULL,
    status BOOLEAN DEFAULT FALSE,
    id_post INT NOT NULL,
    id_user INT NOT NULL,    
    FOREIGN KEY (id_post) REFERENCES post(id),
    FOREIGN KEY (id_user) REFERENCES user(id)
);
```
# TODO

1. por ejemplo en user ; contraseña
2. y en usuarios un campo mas que diga activo o inactivo

- add `pasword` and `status` `user`
- add status 



## DIAGRAM

![](https://i.imgur.com/RIf7eOS.png)


-----
