# BV-SIS Phase 1 — Database Validation

**Date:** 9 July 2026  
**Command:** `php artisan migrate:fresh --seed --force`  
**Verdict:** PASS

---

## Migration Run

| Migration | Result |
|-----------|--------|
| 0001_01_01_000000_create_users_table | DONE |
| 0001_01_01_000001_create_cache_table | DONE |
| 0001_01_01_000002_create_jobs_table | DONE |
| 2026_07_08_000000_create_permission_tables | DONE |
| 2026_07_08_000001_add_fields_to_users_table | DONE |
| 2026_07_08_000002_create_system_settings_table | DONE |
| 2026_07_08_000003_create_user_preferences_table | DONE |
| 2026_07_08_000004_create_saved_filters_table | DONE |
| 2026_07_08_000005_create_activity_log_table | DONE |
| 2026_07_08_000006_create_media_table | DONE |
| 2026_07_09_000000_create_institution_setup_tables | DONE |

**SQL errors:** None (after AreaOfStudy model fix)  
**Foreign keys:** Succeeded  
**Indexes / uniques:** Succeeded  
**Duplicate columns:** None  
**Missing tables:** None

---

## Institution Tables (13)

| # | Table | Verified |
|---|-------|----------|
| 1 | institutions | ✓ |
| 2 | campuses | ✓ |
| 3 | faculties | ✓ |
| 4 | areas_of_study | ✓ |
| 5 | programmes | ✓ |
| 6 | programme_tracks | ✓ |
| 7 | academic_sessions | ✓ |
| 8 | study_plan_periods | ✓ |
| 9 | programme_structures | ✓ |
| 10 | programme_structure_items | ✓ |
| 11 | academic_paths | ✓ |
| 12 | academic_intakes | ✓ |
| 13 | institution_documents | ✓ |

---

## Seed Results

| Seeder | Result |
|--------|--------|
| RolesAndPermissionsSeeder | DONE |
| UserSeeder | DONE (super_admin, system_admin + role QA users) |
| SystemSettingsSeeder | DONE |
| InstitutionSetupSeeder | DONE |

### Sample data counts (post-seed)

| Entity | Count |
|--------|-------|
| institutions | 1 |
| campuses | 2 |
| faculties | 2 |
| areas_of_study | 3 |
| programmes | 2 |
| programme_tracks | 2 |
| academic_sessions | 1 |
| study_plan_periods | 2 |
| programme_structures | 1 |
| academic_paths | 1 |
| academic_intakes | 1 |

---

## Model Schema Alignment

| Model | Table override | Soft deletes | UUID trait | Status cast |
|-------|----------------|--------------|------------|-------------|
| AreaOfStudy | `areas_of_study` **FIXED** | ✓ | ✓ | ✓ |
| Faculty | `faculties` | ✓ | ✓ | ✓ |
| Others | Laravel default | ✓ | ✓ | ✓ |

---

## Critical Fix During Validation

**Bug:** Eloquent pluralized `AreaOfStudy` → `area_of_studies` (table does not exist).  
**Fix:** `protected $table = 'areas_of_study';` on `AreaOfStudy` model.  
**Re-test:** `migrate:fresh --seed` completed successfully.
