From 83d0f693fb3b81e6e43ffe3e870f40604db0e4e1 Mon Sep 17 00:00:00 2001 From: Yannick Schinko Date: Tue, 28 Oct 2025 11:26:55 +0100 Subject: [PATCH 1/3] Add support for `decimal` column type Previously `decimal` columns were represented with a cast. This now is no longer the case and instead the column type itself is `decimal`. This change takes that into account. --- src/Console/ModelsCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 4f22206b3..c48c53a0d 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -584,6 +584,8 @@ public function getPropertiesFromTable($model) 'float', 'real', 'float4', 'double', 'float8' => 'float', + 'decimal' => 'numeric', + default => 'string', }; } From 794f3702ef1d240f1d283574c6a909ed6aec6172 Mon Sep 17 00:00:00 2001 From: BrainStone Date: Tue, 28 Oct 2025 23:51:36 +0100 Subject: [PATCH 2/3] The column type may also be `numeric` --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index c48c53a0d..1023b2f3b 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -584,7 +584,7 @@ public function getPropertiesFromTable($model) 'float', 'real', 'float4', 'double', 'float8' => 'float', - 'decimal' => 'numeric', + 'decimal', 'numeric' => 'numeric', default => 'string', }; From 07e07e089d49737c6276dd15869bee8c3ad63423 Mon Sep 17 00:00:00 2001 From: BrainStone Date: Tue, 28 Oct 2025 23:51:45 +0100 Subject: [PATCH 3/3] Update tests --- .../AllowGlobDirectory/__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../GenerateBasicPhpdoc/__snapshots__/Test__test__1.php | 4 ++-- .../GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php | 4 ++-- .../GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 4 ++-- .../GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php | 4 ++-- .../ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php | 4 ++-- .../ModelsCommand/QueryScopes/__snapshots__/Test__test__1.php | 4 ++-- .../RelationCountProperties/__snapshots__/Test__test__1.php | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php index 2b17017f1..e6786cf9b 100644 --- a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php @@ -42,8 +42,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index 54411a6cc..ca5b265fc 100644 --- a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -48,8 +48,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php index 46145aae7..48f10e240 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -44,8 +44,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php index 5b12d69ea..41899c98a 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php @@ -42,8 +42,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php index b041db784..1ddaa014a 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php @@ -42,8 +42,8 @@ * @property float $floatNotNullable * @property float|null $doubleNullable * @property float $doubleNotNullable - * @property string|null $decimalNullable - * @property string $decimalNotNullable + * @property numeric|null $decimalNullable + * @property numeric $decimalNotNullable * @property int|null $booleanNullable * @property int $booleanNotNullable * @property string|null $enumNullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php index 799c7aec7..267388a5b 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php @@ -42,8 +42,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index a194fd7b7..cd22c007d 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -48,8 +48,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php index 8683a319d..6efda0e40 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -43,8 +43,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php index b95c9da2c..a8006df63 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php @@ -44,8 +44,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php index b307b80e1..e1dc204be 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php @@ -50,8 +50,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php index b076bb206..85556a015 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php @@ -48,8 +48,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index d6c9340f6..0aceca246 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -95,8 +95,8 @@ final class IdeHelperFinalPost {} * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php index e550fca41..1338230b5 100644 --- a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php @@ -42,8 +42,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/QueryScopes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/QueryScopes/__snapshots__/Test__test__1.php index e6b258889..70cec8fa9 100644 --- a/tests/Console/ModelsCommand/QueryScopes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/QueryScopes/__snapshots__/Test__test__1.php @@ -81,8 +81,8 @@ protected function scopeSystem(Builder $query): void * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php index 48f72bf2d..651544c95 100644 --- a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php @@ -43,8 +43,8 @@ * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable - * @property string|null $decimal_nullable - * @property string $decimal_not_nullable + * @property numeric|null $decimal_nullable + * @property numeric $decimal_not_nullable * @property int|null $boolean_nullable * @property int $boolean_not_nullable * @property string|null $enum_nullable