Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add timezone. Cheap and backwards compatible.
James Cole899c72d0682b
diff --git a/config/firefly.php b/config/firefly.phpindex ef5d30a2a9..7ba69a7a45 100644--- a/config/firefly.php+++ b/config/firefly.php@@ -112,7 +112,7 @@ return [],'version' => 'develop/2024-11-04','api_version' => '2.1.0',- 'db_version' => 24,+ 'db_version' => 25,// generic settings'maxUploadSize' => 1073741824, // 1 GBdiff --git a/database/migrations/2024_11_05_062108_add_date_tz_columns.php b/database/migrations/2024_11_05_062108_add_date_tz_columns.phpnew file mode 100644index 0000000000..b686a69433--- /dev/null+++ b/database/migrations/2024_11_05_062108_add_date_tz_columns.php@@ -0,0 +1,63 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\QueryException;+use Illuminate\Database\Schema\Blueprint;++return new class extends Migration {+ private array $tables;++ public function __construct()+ {+ $this->tables = [+ 'account_balances' => ['date'],+ 'available_budgets' => ['start_date', 'end_date'],+ 'bills' => ['date','end_date', 'extension_date'],+ 'budget_limits' => ['start_date', 'end_date'],+ 'currency_exchange_rates' => ['date'],+ 'invited_users' => ['expires'],+ 'limit_repetitions' => ['startdate', 'enddate'],+ 'piggy_bank_events' => ['date'],+ 'piggy_bank_repetitions' => ['startdate', 'targetdate'],+ 'piggy_banks' => ['startdate', 'targetdate'],+ 'recurrences' => ['first_date', 'repeat_until', 'latest_date'],+ 'tags' => ['date'],+ 'transaction_journals' => ['date'],+ ];+ }++ /**+ * Run the migrations.+ * TODO journal_meta, all date fields?+ *+ */+ public function up(): void+ {+ foreach ($this->tables as $table => $columns) {+ foreach ($columns as $column) {+ $newColumn = sprintf('%s_tz', $column);+ if (Schema::hasColumn($table, $column) && !Schema::hasColumn($table, $newColumn)) {+ try {+ Schema::table(+ $table,+ static function (Blueprint $table) use ($column, $newColumn): void {+ $table->string($newColumn, 50)->nullable()->after($column);+ }+ );+ } catch (QueryException $e) {+ app('log')->error(sprintf('Could not add column "%s" to table "%s" query: %s', $newColumn, $table, $e->getMessage()));+ app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');+ }+ }+ }+ }+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ //+ }+};