<?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('user_profiles', function (Blueprint $table) {

            $table->id();

            $table->foreignId('user_id')
                ->unique()
                ->constrained()
                ->cascadeOnDelete();

            $table->string('nik', 30)->nullable();

            $table->string('phone', 30)->nullable();

            $table->text('address')->nullable();

            $table->unsignedBigInteger('provinsi_id')->nullable();

            $table->unsignedBigInteger('kabupaten_id')->nullable();

            $table->unsignedBigInteger('kecamatan_id')->nullable();

            $table->unsignedBigInteger('desa_id')->nullable();

            $table->timestamps();
        });
    }

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