Skip to content

Commit 7f8cbbb

Browse files
committed
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.
1 parent d209b28 commit 7f8cbbb

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

core/scripts/init.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ docker compose exec engine timeout 300 bash -c 'while [[ "$(curl -k -s -o /dev/n
3333
echo
3434
echo -e "${ORANGE}Initializing EB database$NOCOLOR ${VINKJE}"
3535
echo
36-
if [[ "${GITHUB_ACTIONS}" == "true" ]]; then
37-
echo "Checking if the database is already present"
38-
if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod > /dev/null 2>&1
39-
then
40-
echo "Creating the database schema"
41-
docker compose exec engine /var/www/html/bin/console doctrine:schema:update --force -q
42-
fi
43-
else
44-
echo "Running database migrations"
45-
cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction'
46-
${cmd}
47-
fi
36+
echo "Ensure database is created"
37+
cmd='docker compose exec engine /var/www/html/bin/console doctrine:database:create --env=prod --if-not-exists --no-interaction'
38+
${cmd}
39+
cmd='docker compose exec engine /var/www/html/bin/console doctrine:database:create --env=ci --if-not-exists --no-interaction'
40+
${cmd} 2>/dev/null || true
41+
42+
echo "Running database migrations"
43+
cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction'
44+
${cmd}
4845

4946
echo "Clearing the cache"
5047
docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod

0 commit comments

Comments
 (0)