pvc/api-daemon/pvc-api-db-migrate
Joshua M. Boniface 560cb609ba Add database management with SQLAlchemy
Add management of the pvcprov database with SQLAlchemy, to allow
seamless management of the database. Add automatic tasks to the postinst
of the API to execute these migrations.
2020-02-15 22:51:27 -05:00

18 lines
406 B
Bash
Executable File

#!/bin/bash
# Apply PVC database migrations
# Part of the Parallel Virtual Cluster (PVC) system
PVC_CONFIG_FILE="/etc/pvc/pvcapid.yaml"
PVC_SHARE_DIR="/usr/share/pvc"
if [[ ! -f ${PVC_CONFIG_FILE} ]]; then
echo "Create a configuration file at ${PVC_CONFIG_FILE} before upgrading the database."
exit 1
fi
pushd ${PVC_SHARE_DIR}
./pvcapid-manage.py db migrate
./pvcapid-manage.py db upgrade
popd