<?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_table1', function (Blueprint $table) {
            $table->id('DatasetTable1Id');
            $table->integer('dataset_id');
            $table->string('nama_kawasan_1')->nullable();
            $table->string('nama_kawasan_2')->nullable();
            $table->string('nama_kawasan_3')->nullable();
            $table->string('nama_kawasan_4')->nullable();
            $table->float('luas_kawasan')->default(0);
            $table->float('tutupan_lahan_vegetasi')->default(0);
            $table->float('tutupan_lahan_area_terbangun')->default(0);
            $table->float('tutupan_lahan_tanah_terbuka')->default(0);
            $table->float('tutupan_lahan_badan_air')->default(0);
            $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_table1s');
    }
};
