2022-12-17 08:26:32 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
# ensure migrate env is initialized
|
2024-07-19 21:27:13 +02:00
|
|
|
$(migrate version >/dev/null 2>&1)
|
2022-12-17 08:26:32 +01:00
|
|
|
version=$?
|
|
|
|
if [ $version != "0" ]
|
|
|
|
then
|
|
|
|
echo "Creating base table..."
|
2024-07-19 21:27:13 +02:00
|
|
|
$(migrate init >/dev/null 2>&1)
|
2022-12-17 08:26:32 +01:00
|
|
|
init=$?
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check again
|
2024-07-19 21:27:13 +02:00
|
|
|
$(migrate version >/dev/null 2>&1)
|
2022-12-17 08:26:32 +01:00
|
|
|
version=$?
|
|
|
|
if [ $version != "0" ]
|
|
|
|
then
|
|
|
|
echo "Unable to run migrations."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# run migrations
|
2024-07-19 21:27:13 +02:00
|
|
|
migrate up
|
2022-12-17 08:26:32 +01:00
|
|
|
|
2024-07-19 21:27:13 +02:00
|
|
|
exit 0
|