# MAYA OS ENTERPRISE — CONTROLLED RESTORE & DR VERIFICATION

## 1. Non-Destructive Backup Verification (`--verify-only`)

Always test backup integrity and decryption cleanly without touching the live database:

```bash
./restore.sh --file ./backups/maya_os_maya_os_20261202T160000Z.sql.gz --verify-only
```

This checks the `.sha256` manifest, decrypts (if `.enc`), decompresses, and inspects the SQL dump header.

## 2. Full Database Restore Procedure

1. Put Maya OS into maintenance mode (handled automatically by `./restore.sh` or manually via `./maintenance-mode.sh enable`).
2. Run a controlled restore (requires explicit `--confirm` safety flag and automatically snapshots the current database first):
   ```bash
   ./restore.sh \
     --file ./backups/maya_os_maya_os_20261202T160000Z.sql.gz \
     --target-db maya_os \
     --confirm
   ```
   For Docker deployments append `--docker`.
3. `restore.sh` automatically applies any pending forward migrations (`manage.py migrate --noinput`), runs `manage.py check`, and exits maintenance mode.

## 3. Restore Verification Drill

Test full restore quarterly against an isolated scratch MySQL database (`--target-db maya_os_dr_drill`) followed by `./health-check.sh` and Trial Balance equality verification.

