From 8ae303d1bc0ab4501078421c1838fc6392bb8bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Sun, 13 Sep 2026 14:57:50 +0200 Subject: [PATCH] chore: create the test database on ddev start --- .ddev/config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 3f9e118..09c725d 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -305,3 +305,11 @@ corepack_enable: false ## Un-comment to consume async message. # post-start: # - exec: symfony run --daemon --watch=config,src,templates,vendor bin/console messenger:consume async -vv + +# DDEV's `db` user may only touch the `db` database, so `doctrine:database:create` cannot make +# the `_test` database that `when@test`'s dbname_suffix points at -- it fails with "Access +# denied". Create it as root on every start instead, and hand the `db` user rights to it, so a +# fresh checkout can run `vendor/bin/phpunit` without any manual setup. +hooks: + post-start: + - exec: mysql -uroot -proot -hdb -e "CREATE DATABASE IF NOT EXISTS db_test CHARACTER SET utf8mb4; GRANT ALL ON db_test.* TO 'db'@'%'; FLUSH PRIVILEGES;"