To write automated update tests for Drupal 8 & 9, one often needs to use a fixture with a database dump as explained in the doc
Writing Automated Update Tests for Drupal 8 →
. The tool used to generate such a dump is only compatible with MySQL as explained in a comment in "DbDumpCommand.php":
* @todo This command is currently only compatible with MySQL. Making it
* backend-agnostic will require \Drupal\Core\Database\Schema support the
* ability to retrieve table schema information. Note that using a raw
* SQL dump file here (eg, generated from mysqldump or pg_dump) is not an
* option since these tend to still be database-backend specific.
* @see https://www.drupal.org/node/301038
I'm participating to the development of a module that only works with PostgreSQL and I can't use the following command line to generate a dump:
php ./core/scripts/db-tools.php dump-database-d8-mysql --database-url='pgsql://login:password@127.0.0.1:5432/drupal_database'
php ./core/scripts/db-tools.php dump-database-d8-mysql --database-url='pgsql://login:password@127.0.0.1:5432/drupal_database'
You will get the exception This script can only be used with MySQL database backends.
.
I'm not sure having \Drupal\Core\Database\Schema support the ability to retrieve table schema information is a requirement. Maybe it is? However, I succeeded in generating a dump using the attached patch. This patch is only based on DB queries that use SQL information_schema and should be generic enough.
Test this patch against MySQL database to make sure the dumps are not altered compared with the original version of the scripts. Try on different environments (PostgreSQL versions) than mine.
A new protected member function "getDrupalSchemaName()" has been added to Drupal\Core\Command\DbDumpCommand.
Active
11.0 🔥
Particularly affects sites running on the PostgreSQL database.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.