Use platforms to decide which migrations to use, instead of drivers

Dev environment uses an delegated dev driver, which is not possible to compare. Should fix current phpunit test error.
This commit is contained in:
Jan Böhmer 2022-07-17 23:45:17 +02:00
parent 2de99bca30
commit c079cc914e

View file

@ -8,6 +8,9 @@ use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\AbstractSQLiteDriver; use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -124,11 +127,11 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
*/ */
public function getDatabaseType(): ?string public function getDatabaseType(): ?string
{ {
if ($this->connection->getDriver() instanceof AbstractMySQLDriver) { if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
return 'mysql'; return 'mysql';
} }
if ($this->connection->getDriver() instanceof AbstractSQLiteDriver) { if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
return 'sqlite'; return 'sqlite';
} }