<?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('referensi_alternatifs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('plant_id');
            $table->unsignedBigInteger('criteria_id');
            $table->double('value_alternatif');
            $table->timestamps();
        });

        schema::table('referensi_alternatifs', function (Blueprint $table) {
            $table->foreign('plant_id')->references('id')->on('plants');
            $table->foreign('criteria_id')->references('id')->on('criteria_data');
        });
    }

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