Skip to content

Commit

Permalink
tools: improved version error handling for tools/create-sql-migration.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TyIsI committed Dec 1, 2024
1 parent 4428dc5 commit 34503e3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/create-sql-migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ TS=$(node -e 'console.log(Date.now())')

VERSION="$1"

if [ "${VERSION}" != "new" ] && [ "$(echo "${VERSION}" | grep -E '[0-9]+')" = "" ]; then
echo "ERROR: specified version is not a valid migration id"
echo ""
echo "$(basename "$0") <migration id | 'new'> <description>"

exit 254
fi

if [ "${VERSION}" = "new" ]; then
VERSION=$(find migrations/ -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 basename | sort -V | tail -1 | awk '{ print $1 + 1 }')
fi
Expand Down

0 comments on commit 34503e3

Please sign in to comment.