<?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('dataset_table4', function (Blueprint $table) {
            $table->id('DatasetTable4Id');
            $table->integer('dataset_id');
            $table->string('golongan')->nullable();
            $table->string('nama_spesies_latin')->nullable();
            $table->string('nama_spesies_lokal')->nullable();
            $table->string('status_endemik')->nullable();
            $table->string('status_terancam')->nullable();
            $table->string('status_dilindungi')->nullable();
            $table->string('status_tidak_dilindungi')->nullable();
            $table->integer('created_by');
            $table->timestampsTz();
            $table->softdeletesTz();

            $table->foreign('dataset_id')->references('DatasetId')->on('dataset')->cascadeOnDelete();
        });
    }

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