Added support of the custom TinyInt type for postgres

This commit is contained in:
Jan Böhmer 2024-06-06 22:38:33 +02:00
parent 5402d7bedb
commit d202ecf06f

View file

@ -22,7 +22,9 @@ declare(strict_types=1);
*/
namespace App\Doctrine\Types;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Types\Type;
/**
@ -33,7 +35,13 @@ class TinyIntType extends Type
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
return 'TINYINT';
//MySQL and SQLite know the TINYINT type directly
if ($platform instanceof AbstractMySQLPlatform || $platform instanceof SqlitePlatform) {
return 'TINYINT';
}
//For other platforms, we use the smallest integer type available
return $platform->getSmallIntTypeDeclarationSQL($column);
}
public function getName(): string