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

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

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