<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('{{ tableName }}', function (Blueprint $table) {
            $table->id();
            $table->boolean('is_active')->default(1);
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('{{ translationsTable }}', function (Blueprint $table) {
            $table->id();
            $table->string('locale')->nullable();
            $table->foreignId('{{ foreignKey }}')->constrained()->cascadeOnDelete();
            $table->unique(['{{ foreignKey }}', 'locale']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('{{ translationsTable }}');
        Schema::dropIfExists('{{ tableName }}');
    }
};
