Transaction Model: explicitly cast decimal to string

Laravel defers to PDO & the underlying database as to what type decimals are cast as.
When using sqlite text that match a float will be returned as a float, while mySql always returns a string for a decimal.
This leads to crashes with sqlite while trying to import tranansactions. (It does not happen every transaction, only when the balance{before,after} coming from the database is floatable)

`FireflyIII\Support\Models\AccountBalanceCalculator::getLatesBalance(): Return value must be of type string, float returned.`

Fixes: #9458

Signed-off-by: yparitcher <y@paritcher.com>
This commit is contained in:
yparitcher
2024-11-15 00:03:21 -05:00
committed by GitHub
parent dddaa25d86
commit 59fae290e5

View File

@@ -54,6 +54,8 @@ class Transaction extends Model
'bill_name_encrypted' => 'boolean',
'reconciled' => 'boolean',
'balance_dirty' => 'boolean',
'balance_before' => 'string'
'balance_after' => 'string'
'date' => 'datetime',
];