From 0176f5bbf883bda2f71539600685bfead5f8de12 Mon Sep 17 00:00:00 2001 From: Jim Fingal Date: Sun, 8 Nov 2020 11:50:20 -0800 Subject: [PATCH] Pull initdb into a function; have db commands exec instead of run to ensure container is up --- fr-dev | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fr-dev b/fr-dev index 163cb4c6..9766ca88 100755 --- a/fr-dev +++ b/fr-dev @@ -9,30 +9,35 @@ function clean { } function rundb { - docker-compose run --rm db $@ + docker-compose exec db $@ } function runweb { docker-compose run --rm web $@ } +function initdb { + runweb python manage.py migrate + runweb python manage.py initdb +} + case "$1" in up) docker-compose up --build ;; run) - docker-compose run --service-ports web + docker-compose run --rm --service-ports web ;; initdb) - runweb python manage.py migrate - runweb python manage.py initdb + initdb ;; resetdb) clean + docker-compose up --build -d rundb dropdb -U fedireads fedireads rundb createdb -U fedireads fedireads - runweb python manage.py migrate - runweb python manage.py initdb + initdb + clean ;; makemigrations) runweb python manage.py makemigrations