<?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('face_verifications', function (Blueprint $table) {
            $table->string('context', 32)->default('profile')->after('user_id')->index();
            $table->foreignId('withdrawal_id')->nullable()->after('user_id')->constrained('withdrawals')->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('face_verifications', function (Blueprint $table) {
            $table->dropConstrainedForeignId('withdrawal_id');
            $table->dropColumn('context');
        });
    }
};
