Skip to content

Commit bf38dc9

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 bf38dc9

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

core/scripts/init.sh

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ 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}
41+
echo "Running database migrations"
42+
cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction'
43+
${cmd}
4844

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

0 commit comments

Comments
 (0)