Commit b6ad9d77 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix migration FK — table is 'academies' not 'organizations'

Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 92001ac6
...@@ -12,7 +12,7 @@ public function up(): void ...@@ -12,7 +12,7 @@ public function up(): void
Schema::create('facility_rent_payments', function (Blueprint $table) { Schema::create('facility_rent_payments', function (Blueprint $table) {
$table->id(); $table->id();
$table->uuid('uuid')->unique(); $table->uuid('uuid')->unique();
$table->foreignId('academy_id')->constrained('organizations'); $table->foreignId('academy_id')->constrained('academies');
$table->foreignId('branch_id')->nullable()->constrained('branches'); $table->foreignId('branch_id')->nullable()->constrained('branches');
$table->foreignId('facility_id')->constrained('facilities'); $table->foreignId('facility_id')->constrained('facilities');
$table->string('period', 7); // YYYY-MM $table->string('period', 7); // YYYY-MM
......
...@@ -12,7 +12,7 @@ public function up(): void ...@@ -12,7 +12,7 @@ public function up(): void
Schema::create('expenses', function (Blueprint $table) { Schema::create('expenses', function (Blueprint $table) {
$table->id(); $table->id();
$table->uuid('uuid')->unique(); $table->uuid('uuid')->unique();
$table->foreignId('academy_id')->constrained('organizations'); $table->foreignId('academy_id')->constrained('academies');
$table->foreignId('branch_id')->nullable()->constrained('branches'); $table->foreignId('branch_id')->nullable()->constrained('branches');
$table->string('category', 30); $table->string('category', 30);
$table->bigInteger('amount'); $table->bigInteger('amount');
......
...@@ -19,7 +19,7 @@ public function up(): void ...@@ -19,7 +19,7 @@ public function up(): void
} }
// Also seed the 5050 account if missing // Also seed the 5050 account if missing
$academies = DB::table('organizations')->pluck('id'); $academies = DB::table('academies')->pluck('id');
foreach ($academies as $academyId) { foreach ($academies as $academyId) {
DB::table('financial_accounts')->insertOrIgnore([ DB::table('financial_accounts')->insertOrIgnore([
'academy_id' => $academyId, 'academy_id' => $academyId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment