Files
uis-cloud-computing/backend/README.md

25 lines
764 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Backend automatické migrace (Alembic)
## Automatické migrace
Při spuštění backendu v Dockeru se automaticky provedou migrace databáze pomocí Alembic (`alembic upgrade head`).
## Ruční práce s migracemi
- Vytvoření nové migrace podle modelů:
```sh
export DATABASE_URL='mysql+asyncmy://root:strongpassword@localhost:3306/group_project'
alembic revision --autogenerate -m "popis migrace"
```
- Aplikace migrací:
```sh
export DATABASE_URL='mysql+asyncmy://root:strongpassword@localhost:3306/group_project'
alembic upgrade head
```
## Poznámky
- Pro autogeneraci migrací je nutné mít nainstalován balíček `pymysql`.
- Modely pro migrace jsou v `app/db.py`.
- Konfigurace Alembic je v `alembic.ini` a `alembic/env.py`.