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

        schema::table('sub_district_alternatifs', function (Blueprint $table) {
            $table->foreign('sub_district_id')->references('id')->on('sub_district');
            $table->foreign('criteria_id')->references('id')->on('criteria_data');
        });
    }

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