2021-09-30 12:39:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Runs the db migrations
|
|
|
|
set +x
|
|
|
|
|
|
|
|
# Construct the connection string for postgres
|
|
|
|
VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME:$DATABASE_PORT/$DATABASE_NAME?sslmode=disable
|
|
|
|
|
|
|
|
# Run the DB migrations
|
|
|
|
echo "Connecting with: $VDB_PG_CONNECT"
|
|
|
|
echo "Running database migrations"
|
2023-03-13 13:38:00 +00:00
|
|
|
./goose -dir migrations postgres "$VDB_PG_CONNECT" up
|
2021-09-30 12:39:48 +00:00
|
|
|
|
|
|
|
# If the db migrations ran without err
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
|
|
echo "Migration process ran successfully"
|
2022-05-27 13:23:48 +00:00
|
|
|
tail -f /dev/null
|
2021-09-30 12:39:48 +00:00
|
|
|
else
|
|
|
|
echo "Could not run migrations. Are the database details correct?"
|
|
|
|
exit 1
|
|
|
|
fi
|