<?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('village_alternatifs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('village_id');
            $table->unsignedBigInteger('criteria_id');
            $table->double('value_alternatif');
            $table->string('month');
            $table->string('year');
            $table->timestamps();
        });

        schema::table('village_alternatifs', function (Blueprint $table) {
            $table->foreign('village_id')->references('id')->on('village');
            $table->foreign('criteria_id')->references('id')->on('criteria_data');
        });
    }

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