<?php

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

return new class extends Migration
{
    /**
     * Add encrypted plain-key storage so a single per-user API key can be
     * returned to every device that belongs to the same Firebase account.
     */
    public function up(): void
    {
        Schema::table('api_client_keys', function (Blueprint $table) {
            $table->text('key_plain_enc')->nullable()->after('key_hash');
        });
    }

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