🗃️ Add database schema, models & seeders (Story 1.2)

Migrations (translations, projects, skills, skill_project), Eloquent models
with belongsToMany relations, scopes, and test seeders (74 translations FR/EN,
10 skills, 3 projects, 12 skill-project links).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 15:11:21 +01:00
parent ec1ae92799
commit bba6128236
14 changed files with 617 additions and 68 deletions

View File

@@ -0,0 +1,27 @@
<?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('translations', function (Blueprint $table) {
$table->id();
$table->string('lang', 5);
$table->string('key_name', 255);
$table->text('value');
$table->timestamps();
$table->unique(['lang', 'key_name'], 'unique_translation');
$table->index('lang', 'idx_lang');
});
}
public function down(): void
{
Schema::dropIfExists('translations');
}
};

View File

@@ -0,0 +1,33 @@
<?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('projects', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique();
$table->string('title_key');
$table->string('description_key');
$table->string('short_description_key');
$table->string('image')->nullable();
$table->string('url')->nullable();
$table->string('github_url')->nullable();
$table->date('date_completed');
$table->boolean('is_featured')->default(false);
$table->integer('display_order')->default(0);
$table->timestamps();
$table->index('display_order');
});
}
public function down(): void
{
Schema::dropIfExists('projects');
}
};

View File

@@ -0,0 +1,30 @@
<?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('skills', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique();
$table->string('name_key');
$table->string('description_key');
$table->string('icon')->nullable();
$table->string('category');
$table->integer('max_level')->default(5);
$table->integer('display_order')->default(0);
$table->timestamps();
$table->index('category');
});
}
public function down(): void
{
Schema::dropIfExists('skills');
}
};

View File

@@ -0,0 +1,28 @@
<?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('skill_project', function (Blueprint $table) {
$table->id();
$table->foreignId('skill_id')->constrained()->cascadeOnDelete();
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
$table->integer('level_before');
$table->integer('level_after');
$table->string('level_description_key')->nullable();
$table->timestamps();
$table->unique(['skill_id', 'project_id']);
});
}
public function down(): void
{
Schema::dropIfExists('skill_project');
}
};