Đóng gói cuối tuần
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
Schema::create('contracts', function (Blueprint $table) {
|
||||
@@ -14,11 +16,11 @@ return new class extends Migration {
|
||||
$table->string('status')->default('Đang hiệu lực');
|
||||
$table->decimal('total_value', 15, 2);
|
||||
$table->decimal('paid_amount', 15, 2)->default(0);
|
||||
// Cột ảo tự động tính số tiền còn lại, dev không cần query tính toán
|
||||
$table->decimal('remaining_amount', 15, 2)->virtualAs('total_value - paid_amount');
|
||||
$table->decimal('remaining_amount', 15, 2)->default(0);
|
||||
$table->decimal('excess_amount', 15, 2)->default(0); // Tiền dư từ đợt trước
|
||||
$table->jsonb('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('contracts'); }
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user