<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::connection('hashes')->create('hashes', function (Blueprint $table) {
            $table->id();
            $table->string('filename')->nullable();
            $table->string('crc32')->nullable()->index();
            $table->string('sha1')->nullable()->index();
            $table->foreignId('dat_reference_id')->constrained('dat_reference')->cascadeOnDelete();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::connection('hashes')->dropIfExists('hashes');
    }
};
