Previously support was added for contrib database drivers to be in the module's namespace and "src" directory. See https://www.drupal.org/node/3123251. We are now using that functionality to move the by core supported database drivers (MySQL, PostgreSQL and SQLite) to their own module. For each database driver is a new core module created.
For database drivers in a module's namespace (as opposed to in Drupal\Driver or Drupal\Core), a module query parameter is added to the database connection URL. For example: pgsql://test_user:test_pass@test_host:5432/test_database?module=pgsql. When using one of the by core supported database drivers, the adding of the module name is not required. The old connection URL's will keep working.
Use-statement to database driver classes
Using the use statement with database driver specific classes in the namespace Drupal\Core\Database\Driver have been deprecated and will be removed before the release of Drupal 11.0.0. The best is to replace them with references to the generic class on which the driver class is based. Like:
use Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Install\Tasksshould now be replaced byuse Drupal\Core\Database\Install\Tasksuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Connectionshould now be replaced byuse Drupal\Core\Database\Connectionuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Deleteshould now be replaced byuse Drupal\Core\Database\Query\Deleteuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\ExceptionHandlershould now be replaced byuse Drupal\Core\Database\ExceptionHandleruse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Insertshould now be replaced byuse Drupal\Core\Database\Query\Insertuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Schemashould now be replaced byuse Drupal\Core\Database\Schemause Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Selectshould now be replaced byuse Drupal\Core\Database\Query\Selectuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Truncateshould now be replaced byuse Drupal\Core\Database\Query\Truncateuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Updateshould now be replaced byuse Drupal\Core\Database\Query\Updateuse Drupal\Core\Database\Driver\{mysql|pgsql|sqlite}\Upsertshould now be replaced byuse Drupal\Core\Database\Query\Upsert
Comments
Breaking change
When upgrading to 9.4 my custom modules are having to implement this now. So this appears to have been implemented as a breaking change instead of a deprecation to be removed later. Specifically the error I am getting is:
EntityUsage::__construct() must be an instance of Drupal\Core\Database\Driver\mysql\Connection, instance of Drupal\mysql\Driver\Database\mysql\Connection givenIn my services.yml file the services just referenced
@databaseas the argument.