Skip to content

Commit 78465c9

Browse files
authored
Merge pull request #85 from igorbenav/docs-for-migrations
Added the comment and in the docs to change docker-compose.yml for migrations
2 parents 1085e2d + 6c91f59 commit 78465c9

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,31 @@ poetry run python -m src.scripts.create_first_superuser
414414
To create the first tier it's similar, you just replace `create_superuser` for `create_tier` service or `create_first_superuser` to `create_first_tier` for scripts. If using `docker compose`, do not forget to uncomment the `create_tier` service in `docker-compose.yml`.
415415

416416
### 4.4 Database Migrations
417+
If you are using the db in docker, you need to change this in `docker-compose.yml` to run migrations:
418+
```sh
419+
db:
420+
image: postgres:13
421+
env_file:
422+
- ./src/.env
423+
volumes:
424+
- postgres-data:/var/lib/postgresql/data
425+
# -------- replace with comment to run migrations with docker --------
426+
expose:
427+
- "5432"
428+
# ports:
429+
# - 5432:5432
430+
```
431+
432+
Getting:
433+
```sh
434+
db:
435+
...
436+
# expose:
437+
# - "5432"
438+
ports:
439+
- 5432:5432
440+
```
441+
417442
While in the `src` folder, run Alembic migrations:
418443
```sh
419444
poetry run alembic revision --autogenerate

docker-compose.yml

+3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ services:
4040
- ./src/.env
4141
volumes:
4242
- postgres-data:/var/lib/postgresql/data
43+
# -------- replace with comment to run migrations with docker --------
4344
expose:
4445
- "5432"
46+
# ports:
47+
# - 5432:5432
4548

4649
redis:
4750
image: redis:alpine

0 commit comments

Comments
 (0)