simply upgrade database

This commit is contained in:
James Swineson 2019-07-12 21:03:19 +08:00
parent 8c85119f5c
commit d8bb62900d

View File

@ -2,22 +2,12 @@
set -Eeuo pipefail
cd /opt/powerdns-admin
DB_MIGRATION_DIR='./migrations'
if [ ! -f ./config.py ]; then
cat ./config_template.py ./docker/Production/config_docker.py > ./config.py
fi
if [ "$1" == gunicorn ]; then
if [ ! -d "${DB_MIGRATION_DIR}" ]; then
flask db init --directory ${DB_MIGRATION_DIR}
flask db migrate -m "Init DB" --directory ${DB_MIGRATION_DIR}
flask db upgrade --directory ${DB_MIGRATION_DIR}
./init_data.py
else
flask db migrate -m "Upgrade DB Schema" --directory ${DB_MIGRATION_DIR}
flask db upgrade --directory ${DB_MIGRATION_DIR}
fi
flask db upgrade
fi
exec "$@"