<?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('users', function (Blueprint $table) {
            // Bcrypt hash of a 4-6 digit Quick PIN. Never the raw PIN. Null
            // means the user has no PIN set and cannot use PIN login at all.
            $table->string('pin_hash')->nullable()->after('two_factor_email_enabled');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('pin_hash');
        });
    }
};
