DB
Running
With docker & docker compose installed, run docker compose up --build.
Note: Add
-dto run the container in the background.
Shutting down
docker compose down
Connecting
- Run
docker psand find the ID of the container. - Run
docker exec -it <ID> psql -U postgres. - In here connect to the database with
\c boozer. - Run SQL commands from here.
Schema
Three tables: users, items and uses.
Users
| Field | Datatype | Key | Comments |
|---|---|---|---|
| user_id | int(20) | PK | AUTO-INC |
| username | varchar(20) | ||
| password | varchar | argon2 | |
| created | int | unix time |
Items
| Field | Datatype | Key | Comments |
|---|---|---|---|
| item_id | int(20) | PK | AUTO-INC |
| name | varchar(40) | ||
| units | float | ||
| added | int | unix time |
Consumptions
| Field | Datatype | Key | Comments |
|---|---|---|---|
| consumption_id | int(20) | PK | AUTO-INC |
| item_id | int(20) | FK | |
| user_id | int(20) | FK | |
| time | int | unix time |