# Backup taken 2026-08-20 10:36:07 — before the PO-2026-00004 stock-take correction

Verified by restoring `whims_dev.sql.gz` into a scratch schema and comparing
row counts, unit totals and inventory value against live. All matched exactly.

## Contents
| File | What |
|---|---|
| whims_dev.sql.gz  | FULL dump: schema, data, routines, triggers, events (32 tables) |
| shipdev.sql.gz    | FULL dump of shipdev |
| worktree.tar.gz   | Project files (no vendor/, node_modules/, .git) |
| repo.bundle       | Complete git history — `git clone repo.bundle` |
| git_uncommitted.patch | Uncommitted working changes at HEAD a4e243bc428c3aa58813b82bf00e686d942601fc |
| reconciliation-outputs.tar.gz | All analysis CSVs + the two source XLSX files |
| 00_BASELINE_METRICS.txt | Pre-change counts — compare after any restore |
| SHA256SUMS        | Integrity checksums |

## NOT backed up
`goparts` (178 GB) — read-only source, never written to by this work.
If the change will touch goparts, STOP and take a targeted dump first.

## Restore the database
```bash
# full replace of whims_dev
zcat whims_dev.sql.gz | mysql --defaults-extra-file=<creds>

# or restore beside the live db to inspect first
zcat whims_dev.sql.gz | sed 's/\`whims_dev\`/\`whims_check\`/g' | mysql --defaults-extra-file=<creds>
```
Dumps use --set-gtid-purged=OFF, required on this server or the restore aborts
with "GTID_PURGED cannot be changed".

## Verify a restore
```sql
SELECT COUNT(*) FROM stocks;                                    -- 6638
SELECT SUM(quantity) FROM stocks;                               -- 6649
SELECT ROUND(SUM(quantity*average_price)*100) FROM stocks WHERE quantity>0;  -- 35227529
SELECT COUNT(*) FROM stock_history;                             -- 124087
```

## Restore the code
```bash
git clone repo.bundle whims-dev-restored
cd whims-dev-restored && git apply ../git_uncommitted.patch
composer install
```
