Piotr Biernat
ab362d3b56
All checks were successful
continuous-integration/drone/push Build is passing
27 lines
423 B
Bash
27 lines
423 B
Bash
#!/usr/bin/env sh
|
|
|
|
# ensure migrate env is initialized
|
|
$(go_migrate version >/dev/null 2>&1)
|
|
version=$?
|
|
if [ $version != "0" ]
|
|
then
|
|
echo "Creating base table..."
|
|
$(go_migrate init >/dev/null 2>&1)
|
|
init=$?
|
|
fi
|
|
|
|
# check again
|
|
$(go_migrate version >/dev/null 2>&1)
|
|
version=$?
|
|
if [ $version != "0" ]
|
|
then
|
|
echo "Unable to run migrations."
|
|
exit 1
|
|
fi
|
|
|
|
# run migrations
|
|
go_migrate up
|
|
echo "Done."
|
|
|
|
exit $version
|