# LeadPilot — Database Backup, Restoration & Disaster Recovery

**Document Version:** 1.0.0 (Phase 5 Database Architecture Lock)  
**Status:** Approved & Formally Recorded  

---

## 1. Backup Strategy Blueprint

LeadPilot is architected for single-command atomic database backups, compatible with standard shared hosting cPanel backups, automated mysqldump cron jobs, and enterprise snapshot tools:

```bash
# Production Automated mysqldump Command (Daily Snapshot)
mysqldump -u leadpilot_user -p --single-transaction --quick --routines --triggers leadpilot_db | gzip > /var/backups/leadpilot/db_$(date +\%Y\%m\%d_\%H\%M\%S).sql.gz
```

* **Options Rationale:** `--single-transaction` ensures InnoDB tables are dumped without locking tables or interrupting active lead ingestion.

---

## 2. Restoration & Verification Protocol

* **Automated Monthly Restore Drill:** A staging/test container executes the restore script monthly to ensure zero corrupted dump files:
  ```bash
  gunzip < /var/backups/leadpilot/db_snapshot.sql.gz | mysql -u test_user -p test_db
  php artisan migrate --dry-run
  ```
