Add migration files for language and translation management: Created migrations for languages, translations, and user_languages tables to support the universal translation system. Each migration includes necessary fields, constraints, and indexes to ensure efficient data handling and relationships.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user