https://github.com/jdaarevalo/docker_postgres_with_data
https://github.com/jdaarevalo/docker_postgres_with_data
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jdaarevalo/docker_postgres_with_data
- Owner: jdaarevalo
- Created: 2021-01-25T16:06:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-11T09:33:54.000Z (about 3 years ago)
- Last Synced: 2024-08-13T07:04:11.469Z (8 months ago)
- Size: 4.42 MB
- Stars: 166
- Watchers: 4
- Forks: 91
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - jdaarevalo/docker_postgres_with_data - (Others)
README
## Creating and filling a Postgres DB with Docker Compose
This project create tables and fill the tables in a Postgres data base. The tables and data that create are in sql/ folder
Read the explanation here [Creating and filling a Postgres DB with Docker compose](https://levelup.gitconnected.com/creating-and-filling-a-postgres-db-with-docker-compose-e1607f6f882f)
## ER Diagram
The ER Diagram of DB is this:
## DB Variables
Set the variables in `sql/fill_tables.sql`
| Parameter | Description |
| ------ | ------ |
| number_of_sales | Number of rows to create in the table sale |
| number_of_users | Number of rows to create in the table users |
| number_of_products | Number of rows to create in the table product |
| number_of_stores | Number of rows to create in the table store |
| number_of_coutries | Number of rows to create in the table country |
| number_of_cities | Number of rows to create in the table city |
| number_of_status_names | Number of rows to create in the table status_name |
| start_date | Date of the first sale |
| end_date | Date of the last sale |## Params
If want change this params in `docker-compose.yaml`
| Parameter | Description |
| ------ | ------ |
| POSTGRES_USER | The Postgres user to connect **postgres** |
| POSTGRES_PASSWORD | The Postgres password to connect **postgres** |
| POSTGRES_DB | The Postgres database name to connect **postgres** |
| port | The port mapped by Postgres is **5432** in your container. In this example, use the port **5438** on the host machine |## Run
```sh
$ docker-compose up
```