Skip to content

Commit cb77bd1

Browse files
authored
feat: Try to create empty database at startup, in order to avoid the error message : "The database is not up or not reachable" if database doesnt exist. (#119)
1 parent 4bc3a1a commit cb77bd1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docker/php/docker-entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
3030
fi
3131

3232
if grep -q ^DATABASE_URL= .env; then
33+
echo "Try to create database"
34+
bin/console doctrine:database:create --if-not-exists --no-interaction
3335
echo "Waiting for db to be ready..."
3436
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
3537
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(bin/console doctrine:query:sql "SELECT 1" 2>&1); do

0 commit comments

Comments
 (0)