add section to setup.md on how to apply migrations

This commit is contained in:
Mika Bomm 2024-10-10 09:41:40 +02:00
parent 918dc268d5
commit 4faf14c518

View file

@ -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 <it/name> /bin/bash
```
4. apply migrations
```bash
#(go into the crates folder)
cd crates
#run migrations
sea-orm-cli migrate fresh
```