mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Add timezone. Cheap and backwards compatible.
This commit is contained in:
@@ -112,7 +112,7 @@ return [
|
|||||||
],
|
],
|
||||||
'version' => 'develop/2024-11-04',
|
'version' => 'develop/2024-11-04',
|
||||||
'api_version' => '2.1.0',
|
'api_version' => '2.1.0',
|
||||||
'db_version' => 24,
|
'db_version' => 25,
|
||||||
|
|
||||||
// generic settings
|
// generic settings
|
||||||
'maxUploadSize' => 1073741824, // 1 GB
|
'maxUploadSize' => 1073741824, // 1 GB
|
||||||
|
@@ -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
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
Reference in New Issue
Block a user