Mercurial > gemma
changeset 4108:6ee5523967ec
Fixed update-db.sh: guarantee order of update scripts.
`find' is not guaranteed to print the found files in any specific
order, the bash pathname expansion on the other hand is guaranteed to
deliver an sorted list.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Mon, 29 Jul 2019 16:53:15 +0200 |
parents | f572722d4e8d |
children | 5317ae66f654 861760675497 |
files | schema/update-db.sh |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/schema/update-db.sh Mon Jul 29 15:59:09 2019 +0200 +++ b/schema/update-db.sh Mon Jul 29 16:53:15 2019 +0200 @@ -98,13 +98,17 @@ current_ver=$( get_version ) -for d in $BASEDIR/updates/* ; do +for d in "$BASEDIR"/updates/* ; do new_ver=$( basename $d ) if [ -d "$d" ] && [ "$new_ver" -gt $current_ver ] ; then echo "Running updates for $new_ver ..." - psql -1qv ON_ERROR_STOP= -p "$port" -d "$db" \ - $(find "$d" -type f -printf ' -f %p') \ + file_args="" + for f in "$d"/* ; do + file_args+=" -f $f" + done + + psql -1qv ON_ERROR_STOP= -p "$port" -d "$db" $file_args \ -c "INSERT INTO gemma_schema_version(version) VALUES ($new_ver)" fi