Database Backup & Restore
Nightly backups with per-institution SQL dumps.
Backup Types
- Daily: Full database dump + per-institution COPY-format SQL files
- Manual: Triggered from the admin backup dashboard
Per-Institution Dump
Each institution gets a institution_{ID}_{Name}.sql file containing:
- Direct tables: Tables with an
InstitutionIDcolumn (filtered byWHERE InstitutionID = @p0) - Indirect tables: Child tables without
InstitutionIDthat link via FK chain (e.g.,LoanSchedules → Loans → InstitutionID)
Restoring
- Admin → Backups → select a backup → Restore → choose institution(s)
- The restore deletes existing institution data (children first, then parents)
- Then executes the per-institution SQL file
- Finally resets all identity sequences
Verification
After restore:
- Verify trial balance (total debits = total credits)
- Run an EOD recompute
- Check that all indirect tables (LoanSchedules, LoanScheduleFees, etc.) are populated
Configuration
| Key | Default | Description |
|---|---|---|
Backup:StoragePath | /var/backups/corewave | Where backup ZIPs are stored |
Backup:PgDumpPath | /usr/bin/pg_dump | pg_dump binary path |
Backup:EncryptionKey | derived from JWT key | AES-256-GCM encryption key |