From ee84035966344c060038dad5a5bde5e23e615270 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sun, 19 Apr 2026 03:16:45 +0800 Subject: [PATCH] Prevention fix -> wallet double refund issue reported by Sin Yee on 20260416 --- ...d_process_status_to_transactions_table.php | 16 +++++-------- ...ocess_status_to_transaction_logs_table.php | 24 +++++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/database/migrations/2026_04_19_012052_add_process_status_to_transactions_table.php b/database/migrations/2026_04_19_012052_add_process_status_to_transactions_table.php index e4ba8a35..af19c5d2 100644 --- a/database/migrations/2026_04_19_012052_add_process_status_to_transactions_table.php +++ b/database/migrations/2026_04_19_012052_add_process_status_to_transactions_table.php @@ -12,13 +12,11 @@ return new class extends Migration public function up(): void { Schema::table('transactions', function (Blueprint $table) { - Schema::table('transactions', function (Blueprint $table) { - $table->unsignedTinyInteger('process_status') - ->nullable() - ->default(null) - ->after('status') - ->index(); - }); + $table->unsignedTinyInteger('process_status') + ->nullable() + ->default(null) + ->after('status') + ->index(); }); } @@ -28,9 +26,7 @@ return new class extends Migration public function down(): void { Schema::table('transactions', function (Blueprint $table) { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('process_status'); - }); + $table->dropColumn('process_status'); }); } }; diff --git a/database/migrations/2026_04_19_015052_add_process_status_to_transaction_logs_table.php b/database/migrations/2026_04_19_015052_add_process_status_to_transaction_logs_table.php index cfc0df68..0780837e 100644 --- a/database/migrations/2026_04_19_015052_add_process_status_to_transaction_logs_table.php +++ b/database/migrations/2026_04_19_015052_add_process_status_to_transaction_logs_table.php @@ -11,14 +11,16 @@ return new class extends Migration */ public function up(): void { + if (!Schema::hasTable('transaction_logs')) { + return; + } + Schema::table('transaction_logs', function (Blueprint $table) { - Schema::table('transaction_logs', function (Blueprint $table) { - $table->unsignedTinyInteger('process_status') - ->nullable() - ->default(null) - ->after('status') - ->index(); - }); + $table->unsignedTinyInteger('process_status') + ->nullable() + ->default(null) + ->after('status') + ->index(); }); } @@ -27,10 +29,12 @@ return new class extends Migration */ public function down(): void { + if (!Schema::hasTable('transaction_logs')) { + return; + } + Schema::table('transaction_logs', function (Blueprint $table) { - Schema::table('transaction_logs', function (Blueprint $table) { - $table->dropColumn('process_status'); - }); + $table->dropColumn('process_status'); }); } };