mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-28 10:15:02 +00:00
6a99762f70
* explicitly wait for db migrations to be completed instead of sleeping w/ burnettk * code rabbit suggestion w/ burnettk * get rid of the set x w/ burnettk --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com>
19 lines
657 B
Bash
19 lines
657 B
Bash
#!/usr/bin/env bash
|
|
|
|
function error_handler() {
|
|
echo >&2 "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
|
|
|
|
current_db_migration_revision=$(poetry run flask db current | awk '{print $1}')
|
|
current_db_migration_head=$(poetry run flask db heads | awk '{print $1}')
|
|
if [[ "$current_db_migration_revision" != "$current_db_migration_head" ]]; then
|
|
echo "Waiting for db migrations to finish"
|
|
echo "current revision: ${current_db_migration_head}"
|
|
echo "head revision: ${current_db_migration_revision}"
|
|
sleep 2
|
|
wait_for_db_migrations
|
|
fi
|