From 7f8cbbbe2cf6380cc24c9b0ab9c069086571fc6b Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Tue, 3 Mar 2026 11:19:59 +0100 Subject: [PATCH] Ensure EB database creation if it does not exist Prior to this change, the initialization script checked for the database schema and created it if necessary. This change only creates the db, and leaves the schema to the migrations. --- core/scripts/init.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/core/scripts/init.sh b/core/scripts/init.sh index 1cb4014..4e37b2b 100755 --- a/core/scripts/init.sh +++ b/core/scripts/init.sh @@ -33,18 +33,15 @@ docker compose exec engine timeout 300 bash -c 'while [[ "$(curl -k -s -o /dev/n echo echo -e "${ORANGE}Initializing EB database$NOCOLOR ${VINKJE}" echo -if [[ "${GITHUB_ACTIONS}" == "true" ]]; then - echo "Checking if the database is already present" - if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod > /dev/null 2>&1 - then - echo "Creating the database schema" - docker compose exec engine /var/www/html/bin/console doctrine:schema:update --force -q - fi -else - echo "Running database migrations" - cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction' - ${cmd} -fi +echo "Ensure database is created" +cmd='docker compose exec engine /var/www/html/bin/console doctrine:database:create --env=prod --if-not-exists --no-interaction' +${cmd} +cmd='docker compose exec engine /var/www/html/bin/console doctrine:database:create --env=ci --if-not-exists --no-interaction' +${cmd} 2>/dev/null || true + +echo "Running database migrations" +cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction' +${cmd} echo "Clearing the cache" docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod