Init: Hoan thanh kien truc V3 va Filament UI
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?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) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('product_id')->constrained('products')->cascadeOnDelete();
|
||||
$table->integer('transfer_order')->default(0);
|
||||
$table->string('contract_type')->default('HĐMB');
|
||||
$table->string('contract_number')->unique();
|
||||
$table->date('signing_date')->nullable();
|
||||
$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->jsonb('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('contracts'); }
|
||||
};
|
||||
Reference in New Issue
Block a user