affiliations

This commit is contained in:
ghassan committed 2026-01-27 16:34:46 +03:00
1 parent 4f3f9c9aad
commit 0b5b3dd3ee
177 files changed
+9660 -8531

No files matched your search

@@ -0,0 +1,60 @@
<?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('skill_acquisitions', function (Blueprint $table) {
// Add start and end dates for skill training
$table->date('start_date')->nullable()->after('duration_months');
$table->date('end_date')->nullable()->after('start_date');
// Link to package, activity, and instructor
$table->foreignId('package_id')->nullable()->after('club_affiliation_id')->constrained('club_packages')->nullOnDelete();
$table->foreignId('activity_id')->nullable()->after('package_id')->constrained('club_activities')->nullOnDelete();
$table->foreignId('instructor_id')->nullable()->after('activity_id')->constrained('club_instructors')->nullOnDelete();
// Add notes about the skill acquisition
$table->text('notes')->nullable()->after('proficiency_level');
// Add indexes
$table->index('start_date');
$table->index('end_date');
$table->index('package_id');
$table->index('instructor_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('skill_acquisitions', function (Blueprint $table) {
$table->dropForeign(['package_id']);
$table->dropForeign(['activity_id']);
$table->dropForeign(['instructor_id']);
$table->dropIndex(['start_date']);
$table->dropIndex(['end_date']);
$table->dropIndex(['package_id']);
$table->dropIndex(['instructor_id']);
$table->dropColumn([
'start_date',
'end_date',
'package_id',
'activity_id',
'instructor_id',
'notes'
]);
});
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('club_member_subscriptions', function (Blueprint $table) {
// Link subscription to club affiliation
$table->foreignId('club_affiliation_id')->nullable()->after('user_id')->constrained('club_affiliations')->nullOnDelete();
$table->index('club_affiliation_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('club_member_subscriptions', function (Blueprint $table) {
$table->dropForeign(['club_affiliation_id']);
$table->dropIndex(['club_affiliation_id']);
$table->dropColumn('club_affiliation_id');
});
}
};
@@ -0,0 +1,35 @@
<?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('instructor_reviews', function (Blueprint $table) {
$table->id();
$table->foreignId('instructor_id')->constrained('club_instructors')->onDelete('cascade');
$table->foreignId('reviewer_user_id')->constrained('users')->onDelete('cascade');
$table->tinyInteger('rating')->unsigned()->comment('1-5 stars');
$table->text('comment')->nullable();
$table->timestamp('reviewed_at');
$table->timestamps();
// Ensure one review per user per instructor
$table->unique(['instructor_id', 'reviewer_user_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('instructor_reviews');
}
};