Add receipt numbers to membership payments

This commit is contained in:
2026-02-05 16:41:04 +08:00
parent 8fc4adb6ad
commit 329877b5bf
12 changed files with 100 additions and 10 deletions

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('membership_payments', function (Blueprint $table) {
$table->string('receipt_number')->nullable()->after('reference');
});
DB::table('membership_payments')
->whereNull('receipt_number')
->whereNotNull('reference')
->where('reference', '<>', '')
->where('notes', 'like', '2026-02-03 會員名冊與會員費與捐款統計資料.xlsx%')
->update(['receipt_number' => DB::raw('reference')]);
}
public function down(): void
{
Schema::table('membership_payments', function (Blueprint $table) {
$table->dropColumn('receipt_number');
});
}
};