Proceed on create if the database exists

This change is useful if the container image allows for you to restore
from a backup when starting.
This commit is contained in:
Matt Colyer
2015-10-26 21:07:35 -07:00
parent 3c1c8f9e80
commit 0a66e18ff3

View File

@@ -44,7 +44,7 @@ case "$1" in
dokku_log_verbose_quiet "Creating container database" dokku_log_verbose_quiet "Creating container database"
DATABASE_NAME="$(get_database_name "$SERVICE")" DATABASE_NAME="$(get_database_name "$SERVICE")"
docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME" docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME 2> /dev/null || echo 'Already exists'"
dokku_log_info2 "$PLUGIN_SERVICE container created: $SERVICE" dokku_log_info2 "$PLUGIN_SERVICE container created: $SERVICE"
dokku "$PLUGIN_COMMAND_PREFIX:info" "$SERVICE" dokku "$PLUGIN_COMMAND_PREFIX:info" "$SERVICE"