feat: person tags system - org-level skills with self-reported and organiser-assigned sources
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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('person_tags', function (Blueprint $table) {
|
||||
$table->ulid('id')->primary();
|
||||
$table->foreignUlid('organisation_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 50);
|
||||
$table->string('category', 50)->nullable();
|
||||
$table->string('icon', 50)->nullable();
|
||||
$table->string('color', 7)->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['organisation_id', 'is_active', 'sort_order']);
|
||||
$table->unique(['organisation_id', 'name']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('person_tags');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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('user_organisation_tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignUlid('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignUlid('organisation_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignUlid('person_tag_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('source', ['self_reported', 'organiser_assigned']);
|
||||
$table->foreignUlid('assigned_by_user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->enum('proficiency', ['beginner', 'experienced', 'expert'])->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamp('assigned_at');
|
||||
|
||||
$table->unique(['user_id', 'organisation_id', 'person_tag_id', 'source'], 'uot_user_org_tag_source_unique');
|
||||
$table->index(['user_id', 'organisation_id']);
|
||||
$table->index('person_tag_id');
|
||||
$table->index(['organisation_id', 'person_tag_id', 'proficiency'], 'uot_org_tag_proficiency_index');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_organisation_tags');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user