From 0bdb4f2e6968eee681431a5e70a94121f9ed3cf3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 25 Oct 2025 11:50:34 +0200 Subject: [PATCH] Fix https://github.com/orgs/firefly-iii/discussions/11104 --- ..._09_25_175248_create_period_statistics.php | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/database/migrations/2025_09_25_175248_create_period_statistics.php b/database/migrations/2025_09_25_175248_create_period_statistics.php index 0cda62b0ef..1e118fc58d 100644 --- a/database/migrations/2025_09_25_175248_create_period_statistics.php +++ b/database/migrations/2025_09_25_175248_create_period_statistics.php @@ -11,34 +11,36 @@ return new class extends Migration */ public function up(): void { - Schema::create('period_statistics', function (Blueprint $table) { - $table->id(); - $table->timestamps(); + if (!Schema::hasTable('period_statistics')) { + Schema::create('period_statistics', function (Blueprint $table) { + $table->id(); + $table->timestamps(); - // reference to user group id. - $table->bigInteger('user_group_id', false, true); + // reference to user group id. + $table->bigInteger('user_group_id', false, true); - $table->integer('primary_statable_id', false, true)->nullable(); - $table->string('primary_statable_type', 255)->nullable(); + $table->integer('primary_statable_id', false, true)->nullable(); + $table->string('primary_statable_type', 255)->nullable(); - $table->integer('secondary_statable_id', false, true)->nullable(); - $table->string('secondary_statable_type', 255)->nullable(); + $table->integer('secondary_statable_id', false, true)->nullable(); + $table->string('secondary_statable_type', 255)->nullable(); - $table->integer('tertiary_statable_id', false, true)->nullable(); - $table->string('tertiary_statable_type', 255)->nullable(); + $table->integer('tertiary_statable_id', false, true)->nullable(); + $table->string('tertiary_statable_type', 255)->nullable(); - $table->integer('transaction_currency_id', false, true); - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); + $table->integer('transaction_currency_id', false, true); + $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); - $table->dateTime('start')->nullable(); - $table->string('start_tz', 50)->nullable(); - $table->dateTime('end')->nullable(); - $table->string('end_tz', 50)->nullable(); - $table->string('type',255); - $table->integer('count', false, true)->default(0); - $table->decimal('amount', 32, 12); - $table->foreign('user_group_id')->references('id')->on('user_groups')->onDelete('cascade'); - }); + $table->dateTime('start')->nullable(); + $table->string('start_tz', 50)->nullable(); + $table->dateTime('end')->nullable(); + $table->string('end_tz', 50)->nullable(); + $table->string('type', 255); + $table->integer('count', false, true)->default(0); + $table->decimal('amount', 32, 12); + $table->foreign('user_group_id')->references('id')->on('user_groups')->onDelete('cascade'); + }); + } } /**