2022-05-16 20:38:48 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function error_handler() {
|
|
|
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
2022-05-17 20:35:38 +00:00
|
|
|
tasks=""
|
|
|
|
if [[ "${1:-}" == "clean" ]]; then
|
|
|
|
tasks="$tasks init"
|
2022-05-16 20:38:48 +00:00
|
|
|
|
2022-05-17 20:35:38 +00:00
|
|
|
rm -rf migrations/
|
|
|
|
rm -f ./src/spiff_workflow_webapp/db.sqlite3
|
2022-05-16 20:38:48 +00:00
|
|
|
|
2022-05-17 20:35:38 +00:00
|
|
|
mysql -uroot -e "DROP DATABASE IF EXISTS spiff_workflow_webapp_development"
|
|
|
|
mysql -uroot -e "CREATE DATABASE spiff_workflow_webapp_development"
|
|
|
|
fi
|
|
|
|
tasks="$tasks migrate upgrade"
|
|
|
|
|
|
|
|
for task in $tasks ; do
|
2022-05-16 20:38:48 +00:00
|
|
|
FLASK_ENV=development FLASK_APP=src/spiff_workflow_webapp poetry run flask db "$task"
|
|
|
|
done
|