Commit 3c335666 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix CLAUDE.md rules — tenant table is 'academies' not 'organizations'

This was the root cause of repeated migration FK failures in production.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent b6ad9d77
...@@ -20,7 +20,7 @@ globs: ["database/migrations/**", "app/Domain/**/Models/**", "app/Models/**"] ...@@ -20,7 +20,7 @@ globs: ["database/migrations/**", "app/Domain/**/Models/**", "app/Models/**"]
- Money: `bigInteger` (piasters, not pounds, not decimal) - Money: `bigInteger` (piasters, not pounds, not decimal)
- Status/type: `string(30)` with CHECK constraint via `DB::statement()` - Status/type: `string(30)` with CHECK constraint via `DB::statement()`
- JSONB: `->default('{}')` or `->default('[]')` — never nullable - JSONB: `->default('{}')` or `->default('[]')` — never nullable
- Every tenant table has `$table->foreignId('academy_id')->constrained('organizations')` - Every tenant table has `$table->foreignId('academy_id')->constrained('academies')`
- Every public entity has `$table->uuid('uuid')->unique()` - Every public entity has `$table->uuid('uuid')->unique()`
- Soft-deletable entities have `$table->softDeletes()` - Soft-deletable entities have `$table->softDeletes()`
- User-created entities have `$table->foreignId('created_by')->constrained('users')` - User-created entities have `$table->foreignId('created_by')->constrained('users')`
......
...@@ -13,7 +13,7 @@ Every domain model (except Organization itself) MUST use the `BelongsToAcademy` ...@@ -13,7 +13,7 @@ Every domain model (except Organization itself) MUST use the `BelongsToAcademy`
## Tables WITHOUT academy_id (exhaustive list) ## Tables WITHOUT academy_id (exhaustive list)
- `organizations` (IS the tenant) - `academies` (IS the tenant)
- `migrations`, `jobs`, `failed_jobs`, `cache`, `sessions`, `password_reset_tokens` - `migrations`, `jobs`, `failed_jobs`, `cache`, `sessions`, `password_reset_tokens`
- `permissions` (shared definitions) - `permissions` (shared definitions)
......
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