Startup script tweaks
* forward goose command * don't idle migrations container
This commit is contained in:
parent
2afa6e9fa5
commit
050c1ae3df
@ -1,6 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Runs the db migrations
|
# Runs the db migrations
|
||||||
set +x
|
set -e
|
||||||
|
|
||||||
|
# Default command is "goose up"
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
set -- "up"
|
||||||
|
fi
|
||||||
|
|
||||||
# Construct the connection string for postgres
|
# Construct the connection string for postgres
|
||||||
VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME:$DATABASE_PORT/$DATABASE_NAME?sslmode=disable
|
VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME:$DATABASE_PORT/$DATABASE_NAME?sslmode=disable
|
||||||
@ -8,12 +13,11 @@ VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME
|
|||||||
# Run the DB migrations
|
# Run the DB migrations
|
||||||
echo "Connecting with: $VDB_PG_CONNECT"
|
echo "Connecting with: $VDB_PG_CONNECT"
|
||||||
echo "Running database migrations"
|
echo "Running database migrations"
|
||||||
./goose -dir migrations postgres "$VDB_PG_CONNECT" up
|
./goose -dir migrations postgres "$VDB_PG_CONNECT" "$@"
|
||||||
|
|
||||||
# If the db migrations ran without err
|
# If the db migrations ran without err
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo "Migration process ran successfully"
|
echo "Migration process ran successfully"
|
||||||
tail -f /dev/null
|
|
||||||
else
|
else
|
||||||
echo "Could not run migrations. Are the database details correct?"
|
echo "Could not run migrations. Are the database details correct?"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user