<?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::create('audit_archives', function (Blueprint $table) {
        $table->id(); $table->foreignId('business_id')->constrained()->cascadeOnDelete();
        $table->unsignedBigInteger('first_log_id'); $table->unsignedBigInteger('last_log_id');
        $table->unsignedInteger('record_count'); $table->string('object_key', 1024); $table->char('sha256', 64);
        $table->char('chain_head', 64)->nullable(); $table->timestamp('verified_at')->nullable(); $table->timestamps();
        $table->unique(['business_id','first_log_id','last_log_id'], 'audit_archive_range_unique');
    }); }
    public function down(): void { Schema::dropIfExists('audit_archives'); }
};
