<?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_table21', function (Blueprint $table) {
            $table->id('DatasetTable21Id');
            $table->integer('dataset_id');
            $table->string('lokasi')->nullable();
            $table->string('nama_perusahaan')->nullable();
            $table->float('luas_pemanfaatan_aliran_air')->default(0);
            $table->float('luas_wisata_alam')->default(0);
            $table->float('luas_perlindungan_kehati')->default(0);
            $table->float('luas_penyelamatan_lingkungan')->default(0);
            $table->float('luas_penyerapan_karbon')->default(0);
            $table->string('sk')->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_table21s');
    }
};
