<?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_table31', function (Blueprint $table) {
            $table->id('DatasetTable31Id');
            $table->integer('dataset_id');
            $table->string('kabupaten_kota')->nullable(); // Kabupaten/Kota/Kec.
            $table->float('jumlah_kk')->default(0);
            $table->float('sendiri')->default(0);
            $table->float('bersama')->default(0);
            $table->float('umum')->default(0);
            $table->float('tidak_menggunakan')->default(0);
            $table->float('tidak_ada_fasilitas')->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_table31s');
    }
};
