<?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('{{table}}', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('{{foreign}}');
            $table->string('locale')->index();
            {{columns}}
            $table->timestamps();

            $table->unique(['{{foreign}}', 'locale']);
            $table->foreign('{{foreign}}')->references('id')->on('{{parent}}')->onDelete('cascade');
        });
    }

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