Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

./dev/add_migration.sh: catch bad migrate call #5945

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dev/add_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ fi
ABSOLUTE_PATH=$(pwd)
migrate create -ext sql -dir $ABSOLUTE_PATH -digits 10 -seq "$1"

if [ -z "$(git status --porcelain -- . | grep "^??")" ]; then
echo "It looks like your migrate command failed to create new .sql files. Try upgrading:"
echo ""
echo " go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate/"
echo ""
exit 1
fi

files=$(ls -1 | grep '^[0-9]'.*\.sql | sort -n | tail -n2)

for f in $files; do
Expand Down