Search code examples
drupalddev

How to pass a database prefix to DDEV?


One of the DDEV sites I manage uses a database that includes a prefix. The default behavior for DDEV is to recreate the settings.ddev.php on every start. But that obviously overwrites anything added, purging any manual addition of the prefix.

Is the assumed solution to stop DDEV from overwriting the file? Or to create another settings file (like settings.local.php) to override what's been overridden? Or am I missing something?

This just seems like something that would exist as a simple variable in the config to generate a more accurate settings.ddev.php file. Thanks!


Solution

  • There are a few straightforward answers:

    • Don't let ddev fiddle with settings at all. Change the project type to 'php' and ddev won't mess with it.
    • Make the changes you want to db settings in settings.php after the inclusion of settings.ddev.php. That should work no matter what. And it should work on your prod site as well.
    • Do the work in settings.local.php, but include it after settings.ddev.php in your settings.php file
    • Take over settings.ddev.php and do whatever you want with it. This just means deleting the line that contains #ddev-generated in settings.ddev.php. After that, ddev won't muck with it at all.