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

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

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