<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('user_profiles', function (Blueprint $table) {
            // Hapus kolom lama
            $table->dropColumn(['gender', 'birth_date']);

            // Tambah kolom baru
            $table->string('voice_keyword')->nullable()->after('email');
            $table->integer('birth_month')->nullable()->after('voice_keyword');
            $table->boolean('face_registered')->default(false)->after('birth_month');
        });
    }

    public function down(): void
    {
        Schema::table('user_profiles', function (Blueprint $table) {
            $table->dropColumn(['voice_keyword', 'birth_month', 'face_registered']);
            $table->string('gender')->nullable();
            $table->date('birth_date')->nullable();
        });
    }
};
