From ecbe09ed1a716b10ebd613f77f10c49ef7e17796 Mon Sep 17 00:00:00 2001 From: ekisu Date: Sat, 17 Aug 2024 21:16:56 -0300 Subject: [PATCH 1/2] feat: use `numeric` type on fields with `decimal` casts --- src/Console/ModelsCommand.php | 2 ++ .../ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index f2a4253c4..996b0b2a0 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -381,6 +381,8 @@ public function castPropertiesType($model) $realType = 'bool'; break; case 'decimal': + $realType = 'numeric'; + break; case 'string': case 'hashed': $realType = 'string'; diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index 225813274..3e99461c0 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -14,7 +14,7 @@ * @property float $cast_to_real * @property float $cast_to_float * @property float $cast_to_double - * @property string $cast_to_decimal + * @property numeric $cast_to_decimal * @property string $cast_to_string * @property bool $cast_to_bool * @property bool $cast_to_boolean From 3b383ed8aa656441df76c6f584652a26282e9af4 Mon Sep 17 00:00:00 2001 From: ekisu Date: Sat, 17 Aug 2024 22:38:11 -0300 Subject: [PATCH 2/2] docs: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a7a6709f..fede370aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - Fix type of hashed model property to `string` ### Changed +- Use `numeric` type on fields with `decimal` casts ### Added