Add receipt numbers to membership payments
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user