From b20d96732b7200128471f67ed4ccae4f19b9812f Mon Sep 17 00:00:00 2001 From: norhan ali Date: Mon, 23 Sep 2024 12:50:53 +0300 Subject: [PATCH] make volumes for database --- docker-compose.yml | 4 ++++ entrypoint.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 51ae787..6e3878b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,8 @@ services: - POSTGRES_DB=microcentral ports: - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data backend: profiles: # will start only if `docker-compose --profile prod up` is used @@ -79,3 +81,5 @@ networks: backend: driver: bridge +volumes: + postgres_data: \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 0230204..b8c185f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,7 +14,7 @@ fi # Run migrations to create tables #poetry run python app/manager.py init_db echo "Running migrations..." -poetry run alembic revision -m "Initial migration" +poetry run alembic revision --autogenerate -m "Initial migration" echo "Revision created" poetry run alembic upgrade head echo "Migrations complete"