<?php

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

// PRC-868 — license_key şifreli saklanır; sorgulanabilir sha256 hash kolonu
// (lisans doğrulama endpoint'i lookup için kullanır).
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('client_software_licenses', function (Blueprint $table) {
            $table->string('license_key_hash', 64)->nullable()->index()->after('license_key');
        });
    }

    public function down(): void
    {
        Schema::table('client_software_licenses', function (Blueprint $table) {
            $table->dropIndex(['license_key_hash']);
            $table->dropColumn('license_key_hash');
        });
    }
};
