<?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::table('language_phrases', function (Blueprint $table) {
            // Add with default value 'default' - all existing data is Default theme
            // New themes (tailwind, etc.) will have their own namespace
            // No NULL values - every translation belongs to a theme
            $table->string('namespace', 50)->default('default')->after('lang_id');
            $table->index('namespace');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('language_phrases', function (Blueprint $table) {
            $table->dropIndex(['namespace']);
            $table->dropColumn('namespace');
        });
    }
};
