# SPCHS Version 1.0 database installation

## Recommended WampServer installation

1. Start WampServer and wait until the tray icon is green.
2. Open phpMyAdmin.
3. Import the files in this exact order:
   1. `01_database_structure.sql`
   2. `02_default_units.sql`
   3. `03_default_equipment.sql`
   4. `04_unit_equipment_mapping.sql`
   5. `05_default_admin.sql`
4. Open `config/db.php` and set the database name to `spchs`.
5. Sign in with:
   - Email: `admin@spchs.local`
   - Password: `Admin@12345`
6. Immediately edit the administrator account and change its email and password.
7. Import the school Excel file through **System Management > Upload School Data**.

## Command-line installation

Run the following from inside this package directory:

```bash
mysql -u root -p < 01_database_structure.sql
mysql -u root -p < 02_default_units.sql
mysql -u root -p < 03_default_equipment.sql
mysql -u root -p < 04_unit_equipment_mapping.sql
mysql -u root -p < 05_default_admin.sql
```

On a default local WampServer installation, the root password may be blank. In that case, omit `-p`.

## Important

The package recreates the database structure. It cannot restore old school, user, or survey rows that were lost when XAMPP was uninstalled unless a separate SQL backup exists.
