docs: database migrations

This commit is contained in:
Théo LUDWIG 2024-08-25 01:50:29 +02:00
parent bf1729cf0d
commit 92787448bb
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
5 changed files with 18 additions and 8 deletions

View File

@ -1,7 +1,12 @@
# Wikipedia Game Solver # Wikipedia Game Solver
> \[!IMPORTANT\] > \[!IMPORTANT\]
> This project is a work in progress, at an early stage of development. > The project is a work in progress, at an early stage of development.
> \[!NOTE\]
> The project is also a way to learn and experiment with a clean monorepo architecture, with [Turborepo](https://turbo.build/repo), and [TypeScript](https://www.typescriptlang.org/) as the main language.
>
> The project setup **can be used as a template/boilerplate for new projects**.
## About ## About
@ -11,11 +16,6 @@ The Wikipedia Game involves players competing to navigate from one [Wikipedia](h
Available online: <https://wikipedia-game-solver.theoludwig.fr> Available online: <https://wikipedia-game-solver.theoludwig.fr>
> \[!NOTE\]
> The project is also a way to learn and experiment with a monorepo architecture, with [Turborepo](https://turbo.build/repo), and [TypeScript](https://www.typescriptlang.org/) as the main language.
>
> The project setup **can be used as a template/boilerplate for new projects**.
## Getting Started ## Getting Started
### Prerequisites ### Prerequisites
@ -51,6 +51,9 @@ node --run dev
# Start the development Docker services (e.g: Database) # Start the development Docker services (e.g: Database)
docker compose --file compose.dev.yaml up docker compose --file compose.dev.yaml up
# Database migrations
node --run database:migrate
# Lint # Lint
node --run lint:editorconfig node --run lint:editorconfig
node --run lint:prettier node --run lint:prettier
@ -73,6 +76,10 @@ node --run ace -- list
```sh ```sh
# Setup and run all the services for you # Setup and run all the services for you
docker compose up --build docker compose up --build
# To execute database migrations
docker compose exec wikipedia-game-solver-api sh
node --run database:migrate
``` ```
#### Services started #### Services started

View File

@ -15,6 +15,7 @@
"ace": "node --import=tsx ./bin/console.ts", "ace": "node --import=tsx ./bin/console.ts",
"tuyau": "node --run ace -- tuyau:generate && node --run ace -- tuyau:generate:openapi --destination=\".adonisjs/openapi.yaml\"", "tuyau": "node --run ace -- tuyau:generate && node --run ace -- tuyau:generate:openapi --destination=\".adonisjs/openapi.yaml\"",
"build": "node --run tuyau", "build": "node --run tuyau",
"database:migrate": "node --run ace -- migration:run",
"test": "c8 node --import=tsx ./bin/test.ts", "test": "c8 node --import=tsx ./bin/test.ts",
"test-shortest-paths": "node --import=tsx ./shortest-paths-tests.ts", "test-shortest-paths": "node --import=tsx ./shortest-paths-tests.ts",
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives", "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives",

View File

@ -36,8 +36,6 @@ services:
POSTGRES_DB: ${DATABASE_NAME} POSTGRES_DB: ${DATABASE_NAME}
command: | command: |
--max_wal_size=4GB --max_wal_size=4GB
ports:
- "${DATABASE_PORT-5432}:${DATABASE_PORT-5432}"
volumes: volumes:
- "wikipedia-solver-postgres-data:/var/lib/postgresql/data" - "wikipedia-solver-postgres-data:/var/lib/postgresql/data"
- "./data:/data/" - "./data:/data/"

View File

@ -11,6 +11,7 @@
"scripts": { "scripts": {
"dev": "turbo run dev --parallel", "dev": "turbo run dev --parallel",
"start": "turbo run start --parallel", "start": "turbo run start --parallel",
"database:migrate": "turbo run database:migrate",
"build": "turbo run build", "build": "turbo run build",
"test": "turbo run test", "test": "turbo run test",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",

View File

@ -31,6 +31,9 @@
"start": { "start": {
"dependsOn": ["build"], "dependsOn": ["build"],
"persistent": true "persistent": true
},
"database:migrate": {
"cache": false
} }
} }
} }