From 4faf14c518e7a9dafdcb503391021a45dbb53d49 Mon Sep 17 00:00:00 2001 From: Mika Bomm Date: Thu, 10 Oct 2024 09:41:40 +0200 Subject: [PATCH] add section to setup.md on how to apply migrations --- SETUP.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/SETUP.md b/SETUP.md index 1d35d15..f5f3c23 100644 --- a/SETUP.md +++ b/SETUP.md @@ -3,6 +3,7 @@ ## Table of Contents 1. [Prerequisites](#prerequisites) 2. [Setup](#setup) +3. [Applying Migrations](#applying-migrations) --- @@ -25,4 +26,32 @@ docker compose -f dev-compose.yml up -d postgres backend frontend this starts all the containers however you can just remove them as you like. If you want to stop all docker containers run ```bash docker compose -f dev-compose.yml down +``` + +# Applying Migrations +If migrations haven't been applied yet you can apply them with the following commands: + +*Note: Plase ensure the database is running* + +1. remove old docker image to rebuild +```bash +docker image remove apfelnetzwerk-backend +``` + +2. check which dockers are running +```bash +docker ps +``` + +3. attach a shell to the running postgres docker container +```bash +docker exec -it /bin/bash +``` + +4. apply migrations +```bash +#(go into the crates folder) +cd crates +#run migrations +sea-orm-cli migrate fresh ``` \ No newline at end of file