20 lines
930 B
PHP
20 lines
930 B
PHP
<?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('settlements', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->foreignUuid('product_id')->constrained('products')->cascadeOnDelete();
|
|
$table->string('type'); // "MÓNG", "THÂN", "CP THI CÔNG"
|
|
$table->decimal('temp_value', 15, 2)->default(0);
|
|
$table->decimal('final_value', 15, 2)->default(0);
|
|
$table->decimal('difference', 15, 2)->virtualAs('final_value - temp_value');
|
|
$table->string('red_book_status')->nullable();
|
|
$table->date('issue_date')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
public function down(): void { Schema::dropIfExists('settlements'); }
|
|
}; |