# Additional academic schools: PostgreSQL API setup

This update is PostgreSQL-only. It adds API endpoints and database tables for:

- School of Health Sciences
- School of Engineering
- School of Natural Sciences
- School of Tourism and Hospitality

## 1. Apply the database migration

Open `new_schools_postgresql.sql` in pgAdmin and run it once against the same PostgreSQL database configured by `config/database.php`. The migration is idempotent: it creates the four school/program/enrollment/performance table sets when absent and seeds one school record per module without creating duplicates.

The individual `*_department_schema.sql` files are included if you prefer to install one school at a time. Do not run both an individual schema and the consolidated file as a separate requirement; all statements use `IF NOT EXISTS` and the seed rows use `ON CONFLICT`.

## 2. Deploy the API files

Place these files in the existing `api/` directory beside `session_auth.php`:

- `additional_school_access.php`
- `health_sciences_department.php`
- `engineering_department.php`
- `natural_sciences_department.php`
- `tourism_hospitality_department.php`

Keep the existing shared PostgreSQL connection at `config/database.php` and bearer-session authentication in place.

## 3. Access control

Each endpoint requires an active signed-in session. Super administrators can access all four modules. Other accounts need the exact matching module title in their `users.permissions` JSON array. Assign these permissions through the existing Access Controls interface; the migration intentionally does not grant the new modules to every account.

## Endpoint mapping

| Module | Endpoint | PostgreSQL table prefix |
|---|---|---|
| School of Health Sciences | `health_sciences_department.php` | `hs_` |
| School of Engineering | `engineering_department.php` | `eng_` |
| School of Natural Sciences | `natural_sciences_department.php` | `ns_` |
| School of Tourism and Hospitality | `tourism_hospitality_department.php` | `th_` |
