<?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('detail_saws', function (Blueprint $table) {
            $table->id();
            $table->foreignId('hasil_saw_id')->constrained('hasil_saws')->onDelete('cascade');
            $table->foreignId('kriteria_id')->constrained('kriterias')->onDelete('cascade');
            $table->foreignId('subkriteria_id')->constrained('subkriterias')->onDelete('cascade');
            $table->foreignId('opsi_subkriteria_id')->constrained('opsisubkriterias')->onDelete('cascade');
            $table->decimal('nilai_normalisasi', 8, 4);
            $table->decimal('nilai_bobot', 8, 4);
            $table->decimal('skor_akhir', 8, 4);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('detail_saws');
    }
};
