diff --git a/api/env.docker b/api/env.docker index c8481245d..37f7580b5 100644 --- a/api/env.docker +++ b/api/env.docker @@ -17,6 +17,8 @@ DJANGO_DATABASE_HOST=db UPSTREAM_DATABASE_HOST=upstream_db UPSTREAM_DATABASE_PORT=5432 +DJANGO_MIGRATE_DB_ON_STARTUP=False + SEMANTIC_VERSION=1.0.0 ELASTICSEARCH_URL=es diff --git a/api/run.sh b/api/run.sh index 16151b44c..04a525f37 100755 --- a/api/run.sh +++ b/api/run.sh @@ -8,4 +8,10 @@ while [ "$(curl -s -o /dev/null -w '%{http_code}' "$es_url")" != "200" ]; do done echo "Elasticsearch connection established!" +# Run any database migrations +if [ "$DJANGO_MIGRATE_DB_ON_STARTUP" != "False" ]; then + echo "Running database migrations..." + python manage.py migrate +fi + exec "$@"