<?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('typo_corrections', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('organization_id')->constrained()->cascadeOnDelete();
            $table->string('input_word');
            $table->string('corrected_word');
            $table->timestamps();

            $table->unique(['organization_id', 'input_word']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('typo_corrections');
    }
};
