Skip to content

Commit

Permalink
Wait for database before attempting DB migration
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 committed Aug 14, 2023
1 parent 0090d42 commit fe6c19c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .docker/php/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer install --prefer-dist --no-progress --no-interaction || true
fi

if [ "$APP_ENV" = 'prod' ]; then
php bin/console doctrine:migrations:migrate --allow-no-migration --no-interaction
fi

if grep -q DATABASE_URL= .env; then
echo "Waiting for database to be ready..."
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
Expand Down Expand Up @@ -47,6 +43,10 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
fi
fi

if [ "$APP_ENV" = 'prod' ]; then
php bin/console doctrine:migrations:migrate --allow-no-migration --no-interaction
fi

fi

exec docker-php-entrypoint "$@"

0 comments on commit fe6c19c

Please sign in to comment.