diff --git a/src/PostgresConnection.php b/src/PostgresConnection.php index 472e622..96ade14 100644 --- a/src/PostgresConnection.php +++ b/src/PostgresConnection.php @@ -15,6 +15,8 @@ use Umbrellio\Postgres\Schema\Builder; use Umbrellio\Postgres\Schema\Grammars\PostgresGrammar; use Umbrellio\Postgres\Schema\Subscribers\SchemaAlterTableChangeColumnSubscriber; +use Umbrellio\Postgres\Schema\Types\NumericType; +use Umbrellio\Postgres\Schema\Types\TsRangeType; class PostgresConnection extends BasePostgresConnection { @@ -22,6 +24,11 @@ class PostgresConnection extends BasePostgresConnection private static $extensions = []; + private $initialTypes = [ + TsRangeType::TYPE_NAME => TsRangeType::class, + NumericType::TYPE_NAME => NumericType::class, + ]; + /** * @param AbstractExtension|string $extension * @throws ExtensionInvalidException @@ -52,6 +59,7 @@ public function useDefaultPostProcessor(): void parent::useDefaultPostProcessor(); $this->registerExtensions(); + $this->registerInitialTypes(); } public function getDoctrineConnection(): Connection @@ -109,6 +117,15 @@ protected function getDefaultSchemaGrammar() return $this->withTablePrefix(new PostgresGrammar()); } + private function registerInitialTypes(): void + { + foreach ($this->initialTypes as $type => $typeClass) { + $this + ->getSchemaBuilder() + ->registerCustomDoctrineType($typeClass, $type, $type); + } + } + /** * @codeCoverageIgnore */ diff --git a/src/Schema/Types/NumericType.php b/src/Schema/Types/NumericType.php new file mode 100644 index 0000000..ee5e9fc --- /dev/null +++ b/src/Schema/Types/NumericType.php @@ -0,0 +1,23 @@ +