https://github.com/gregorykogan/mephi-databases
Laboratory work on the database course at MEPhI.
https://github.com/gregorykogan/mephi-databases
database go golang gorm gorm-orm postgresql sql
Last synced: 5 days ago
JSON representation
Laboratory work on the database course at MEPhI.
- Host: GitHub
- URL: https://github.com/gregorykogan/mephi-databases
- Owner: GregoryKogan
- License: mit
- Created: 2024-10-27T15:00:27.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-20T17:50:47.000Z (5 months ago)
- Last Synced: 2025-02-17T07:20:11.418Z (3 months ago)
- Topics: database, go, golang, gorm, gorm-orm, postgresql, sql
- Language: Go
- Homepage:
- Size: 6.26 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mephi-databases
Laboratory work on the database course at MEPhI.
Topic: TrelloThis project is built in Go, uses [GORM](https://gorm.io/) as an ORM for PostgreSQL and [gofakeit](https://github.com/brianvoe/gofakeit) package to seed the database.
**Checkout the [queries.md](queries.md) file for possible queries to run.**
Entity-relationship diagram
![]()
## Run
The project is dockerized. To run it, you need to have Docker installed on your machine.
If you want to run seeder, you need to pass `--profile seed` to the `docker-compose` command.```bash
docker compose --profile seed up --build
```After the seeder has finished its work, you can run the project without the `--profile seed` flag, because the database will already be populated.
```bash
docker-compose up --build
```### Configuration
Projects's configuration is stored in the `config.yml` file.
Default configuration:```yaml
seeder:
load_batch_size: 2000
create_batch_size: 5000
entities: # Number of entities to create
users: 10000
# Average ratios of entities
# Notice that labels and board members are the most numerous entities (30 times more than users)
# Overall, the number of entities is 161 times more than the number of users
# For example, if you have 10.000 users, you will have 1.610.000 entities in total
boards_per_user: 3 # 3x users
lists_per_board: 3 # 9x users
cards_per_list: 2 # 18x users
labels_per_board: 10 # 30x users
comments_per_card: 0.5 # 9x users
attachments_per_card: 0.333 # 6x users
board_members_per_board: 10 # 30x users
card_labels_per_card: 1.5 # 27x users
card_assignees_per_card: 1.5 # 27x users
```### Benchmark
On my machine (M1Pro MBP 14"), the seeder creates 10k users and 16.1M entities in roughly 40 seconds (with the default configuration).
`pgdata` volume is about 2.7GB.## PgAdmin
PgAdmin will be available at `http://localhost:5050`.
Credentials to connect to the database:
```plaintext
Host name/address: database
Port: 5432
Username: mephi
Password: mephi
```
![]()