ipld-eth-db/scripts/startup_script.sh

21 lines
598 B
Bash
Raw Normal View History

#!/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"
2022-05-10 10:45:57 +00:00
sleep 15
echo "Running database migrations"
2022-05-10 14:03:49 +00:00
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up-to 24
# If the db migrations ran without err
if [[ $? -eq 0 ]]; then
echo "Migration process ran successfully"
else
echo "Could not run migrations. Are the database details correct?"
exit 1
fi