# Remote DB sync (production → local) Config lives in `/Users/david/Sites/daw/wp-cli.yml` (`@production` alias). Set the real SSH `user@host:/path` there first; needs WP-CLI on the remote + SSH key. ## Pull production into local ```bash # 1. Back up local first wp db export _claude/scratch/local-backup-$(date +%F).sql # run from theme dir # 2. Stream prod DB straight into local (no intermediate file) wp @production db export - | wp db import - # 3. Rewrite URLs (and fix serialized data safely) wp search-replace 'https://davidawindham.com' 'https://daw.ovid' --skip-columns=guid # 4. Flush caches (WP Super Cache is active) wp cache flush ``` ## Notes / gotchas - **`--skip-columns=guid`** — never rewrite GUIDs; they're permanent identifiers. - This is a **one-way pull** (prod → local). Never run an import against prod. - Large `wp_options` autoload / transients can bloat the dump — consider `wp transient delete --all` on local after import. - Matomo analytics + Gravity Forms entries come down with the DB; fine for a dev copy, but don't push this DB anywhere public. - Uploads (`wp-content/uploads`) are a separate sync (rsync), not part of the DB.