Skip to content

Firefly III: a personal finances manager

Cast fields to string and drop unused table.

James Cole60f6a91fe4e9
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 4f6930cad9..207871ac6a 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -57,6 +57,7 @@ class Account extends Model
'deleted_at' => 'datetime',
'active' => 'boolean',
'encrypted' => 'boolean',
+ 'virtual_balance' => 'string',
];
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
diff --git a/app/Models/AccountBalance.php b/app/Models/AccountBalance.php
index 5f09ff00fa..d672336a81 100644
--- a/app/Models/AccountBalance.php
+++ b/app/Models/AccountBalance.php
@@ -21,6 +21,7 @@ class AccountBalance extends Model
{
return [
'date' => SeparateTimezoneCaster::class,
+ 'balance' => 'string',
];
}
diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php
index 87a0129281..e481186b23 100644
--- a/app/Models/AutoBudget.php
+++ b/app/Models/AutoBudget.php
@@ -49,6 +49,10 @@ class AutoBudget extends Model
public const int AUTO_BUDGET_ROLLOVER = 2;
protected $fillable = ['budget_id', 'amount', 'period'];
+ protected $casts = [
+ 'amount' => 'string',
+ ];
+
public function budget(): BelongsTo
{
return $this->belongsTo(Budget::class);
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index f2c54a1263..46c5e96e0d 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -49,6 +49,7 @@ class AvailableBudget extends Model
'start_date' => 'date',
'end_date' => 'date',
'transaction_currency_id' => 'int',
+ 'amount' => 'string',
];
protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date', 'start_date_tz', 'end_date_tz'];
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 11397e5aff..db60d116d1 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -58,6 +58,8 @@ class Bill extends Model
'active' => 'boolean',
'name_encrypted' => 'boolean',
'match_encrypted' => 'boolean',
+ 'amount_min' => 'string',
+ 'amount_max' => 'string',
];
protected $fillable
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index faabad9f54..927adb5c8b 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -47,6 +47,7 @@ class BudgetLimit extends Model
'start_date' => SeparateTimezoneCaster::class,
'end_date' => SeparateTimezoneCaster::class,
'auto_budget' => 'boolean',
+ 'amount' => 'string',
];
protected $dispatchesEvents
= [
diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php
index dd9063f803..fbe51b2ce4 100644
--- a/app/Models/CurrencyExchangeRate.php
+++ b/app/Models/CurrencyExchangeRate.php
@@ -49,6 +49,8 @@ class CurrencyExchangeRate extends Model
'from_currency_id' => 'int',
'to_currency_id' => 'int',
'date' => SeparateTimezoneCaster::class,
+ 'rate' => 'string',
+ 'user_rate' => 'string',
];
protected $fillable = ['user_id', 'from_currency_id', 'to_currency_id', 'date', 'date_tz', 'rate'];
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index bd65c314ec..328efe5a93 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -51,6 +51,7 @@ class PiggyBank extends Model
'order' => 'int',
'active' => 'boolean',
'encrypted' => 'boolean',
+ 'targetamount' => 'string',
];
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'startdate_tz', 'targetdate', 'targetdate_tz', 'active'];
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index 035e47dc49..156bd62bb9 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -41,6 +41,7 @@ class PiggyBankEvent extends Model
'created_at' => 'datetime',
'updated_at' => 'datetime',
'date' => SeparateTimezoneCaster::class,
+ 'amount' => 'string',
];
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount'];
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index 826e3bd627..ca86271940 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -44,6 +44,7 @@ class PiggyBankRepetition extends Model
'updated_at' => 'datetime',
'startdate' => SeparateTimezoneCaster::class,
'targetdate' => SeparateTimezoneCaster::class,
+ 'virtual_balance' => 'string',
];
protected $fillable = ['piggy_bank_id', 'startdate', 'startdate_tz', 'targetdate', 'targetdate_tz', 'currentamount'];
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 6fd5864a6c..8ba9a17bfe 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -57,6 +57,8 @@ class Transaction extends Model
'balance_before' => 'string',
'balance_after' => 'string',
'date' => 'datetime',
+ 'amount' => 'string',
+ 'foreign_amount' => 'string',
];
protected $fillable
diff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.php
index 2497070e6f..80000d31f4 100644
--- a/database/migrations/2016_06_16_000002_create_main_tables.php
+++ b/database/migrations/2016_06_16_000002_create_main_tables.php
@@ -294,25 +294,6 @@ class CreateMainTables extends Migration
app('log')->error(self::TABLE_ALREADY_EXISTS);
}
}
- if (!Schema::hasTable('limit_repetitions')) {
- try {
- Schema::create(
- 'limit_repetitions',
- static function (Blueprint $table): void {
- $table->increments('id');
- $table->timestamps();
- $table->integer('budget_limit_id', false, true);
- $table->date('startdate');
- $table->date('enddate');
- $table->decimal('amount', 32, 12);
- $table->foreign('budget_limit_id')->references('id')->on('budget_limits')->onDelete('cascade');
- }
- );
- } catch (QueryException $e) {
- app('log')->error(sprintf(self::TABLE_ERROR, 'limit_repetitions', $e->getMessage()));
- app('log')->error(self::TABLE_ALREADY_EXISTS);
- }
- }
}
private function createCategoriesTable(): void