From 92787448bb88d387b164d640de22b5d4da742e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Sun, 25 Aug 2024 01:50:29 +0200 Subject: [PATCH] docs: database migrations --- README.md | 19 +++++++++++++------ apps/api/package.json | 1 + compose.yaml | 2 -- package.json | 1 + turbo.json | 3 +++ 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1fd40b0..25e5f60 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ # Wikipedia Game Solver > \[!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 @@ -11,11 +16,6 @@ The Wikipedia Game involves players competing to navigate from one [Wikipedia](h Available online: -> \[!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 ### Prerequisites @@ -51,6 +51,9 @@ node --run dev # Start the development Docker services (e.g: Database) docker compose --file compose.dev.yaml up +# Database migrations +node --run database:migrate + # Lint node --run lint:editorconfig node --run lint:prettier @@ -73,6 +76,10 @@ node --run ace -- list ```sh # Setup and run all the services for you docker compose up --build + +# To execute database migrations +docker compose exec wikipedia-game-solver-api sh +node --run database:migrate ``` #### Services started diff --git a/apps/api/package.json b/apps/api/package.json index 0718ffe..32dcbb5 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -15,6 +15,7 @@ "ace": "node --import=tsx ./bin/console.ts", "tuyau": "node --run ace -- tuyau:generate && node --run ace -- tuyau:generate:openapi --destination=\".adonisjs/openapi.yaml\"", "build": "node --run tuyau", + "database:migrate": "node --run ace -- migration:run", "test": "c8 node --import=tsx ./bin/test.ts", "test-shortest-paths": "node --import=tsx ./shortest-paths-tests.ts", "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives", diff --git a/compose.yaml b/compose.yaml index c902720..4916f08 100644 --- a/compose.yaml +++ b/compose.yaml @@ -36,8 +36,6 @@ services: POSTGRES_DB: ${DATABASE_NAME} command: | --max_wal_size=4GB - ports: - - "${DATABASE_PORT-5432}:${DATABASE_PORT-5432}" volumes: - "wikipedia-solver-postgres-data:/var/lib/postgresql/data" - "./data:/data/" diff --git a/package.json b/package.json index 838c757..1a0d99f 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "scripts": { "dev": "turbo run dev --parallel", "start": "turbo run start --parallel", + "database:migrate": "turbo run database:migrate", "build": "turbo run build", "test": "turbo run test", "lint:editorconfig": "editorconfig-checker", diff --git a/turbo.json b/turbo.json index 465f000..1948c84 100644 --- a/turbo.json +++ b/turbo.json @@ -31,6 +31,9 @@ "start": { "dependsOn": ["build"], "persistent": true + }, + "database:migrate": { + "cache": false } } }