<?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('translations', function (Blueprint $table) {
            $table->id();
            $table->string('lang', 5);
            $table->string('key_name', 255);
            $table->text('value');
            $table->timestamps();

            $table->unique(['lang', 'key_name'], 'unique_translation');
            $table->index('lang', 'idx_lang');
        });
    }

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