Issue #3261629 by catch: Database dumps are no longer driver-agnostic

merge-requests/1751/head
Alex Pott 2022-02-02 10:46:36 +00:00
parent cde1d175e4
commit affdb3e70a
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
1 changed files with 7 additions and 3 deletions

View File

@ -415,13 +415,17 @@ use Drupal\Core\Database\Database;
$connection = Database::getConnection(); $connection = Database::getConnection();
// Ensure any tables with a serial column with a value of 0 are created as // Ensure any tables with a serial column with a value of 0 are created as
// expected. // expected.
$sql_mode = $connection->query("SELECT @@sql_mode;")->fetchField(); if ($connection->databaseType() === 'mysql') {
$connection->query("SET sql_mode = '$sql_mode,NO_AUTO_VALUE_ON_ZERO'"); $sql_mode = $connection->query("SELECT @@sql_mode;")->fetchField();
$connection->query("SET sql_mode = '$sql_mode,NO_AUTO_VALUE_ON_ZERO'");
}
{{TABLES}} {{TABLES}}
// Reset the SQL mode. // Reset the SQL mode.
$connection->query("SET sql_mode = '$sql_mode'"); if ($connection->databaseType() === 'mysql') {
$connection->query("SET sql_mode = '$sql_mode'");
}
ENDOFSCRIPT; ENDOFSCRIPT;
return $script; return $script;
} }