Recaje-New/database/migrations/2025_04_29_075420_create_we...

32 lines
892 B
Plaintext

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('weights', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id')->constrained()->onDelete('cascade');
$table->foreignId('subcategory_id')->nullable()->constrained()->onDelete('cascade');
$table->decimal('weight_value', 5, 2); // Bobot untuk kategori atau subkategori
$table->decimal('normalized_weight', 5, 2); // Bobot yang sudah dinormalisasi
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('weights');
}
};