Files
citrus/database/migrations/2025_10_01_053644_create_languages_table.php
T

42 lines
1.5 KiB
PHP

<?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::create('languages', function (Blueprint $table) {
$table->id();
$table->string('code', 10)->unique()->comment('Language code (tr, en, de)');
$table->string('name', 100)->comment('Language name in English');
$table->string('native_name', 100)->comment('Language name in native language');
$table->string('flag', 10)->nullable()->comment('Flag emoji or icon code');
$table->enum('direction', ['ltr', 'rtl'])->default('ltr')->comment('Text direction');
$table->boolean('is_active')->default(true)->comment('Is language active?');
$table->boolean('is_default')->default(false)->comment('Is default language?');
$table->integer('sort_order')->default(0)->comment('Display order');
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
$table->index(['is_active', 'sort_order']);
$table->index('code');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('languages');
}
};