Files
openrun/scripts/backup_db.sh
noisedestroyers 6df25bcd8f P0: untrack Takeout dump + scratch DBs, add CI and DB backup script
- .gitignore now excludes the Garmin Takeout dump (0debd9f2-*/, personal
  health data), ruvector.db / agentdb.rvf scratch files, data/fit/ and
  data/backups/; untracked 23,673 files (kept on disk)
- .gitlab-ci.yml runs pytest via uv on every push
- scripts/backup_db.sh snapshots data/garmin.db (keeps last 14)
- canonical DB is garmin/data/garmin.db; the stray vault-root copy
  (Takeout ingest run from wrong cwd on 2026-06-08) is preserved at
  data/backups/vault-root-takeout-ingest-2026-06-08.db

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 06:14:53 -04:00

20 lines
571 B
Bash
Executable File

#!/bin/sh
# Snapshot the canonical SQLite DB into data/backups/, keeping the last 14.
# Uses sqlite3 .backup (safe against a live WAL). Run from the project root,
# e.g. weekly via launchd/cron, or by hand before risky migrations.
set -eu
cd "$(dirname "$0")/.."
DB=data/garmin.db
OUT=data/backups/garmin-$(date +%Y%m%d-%H%M%S).db
mkdir -p data/backups
sqlite3 "$DB" ".backup $OUT"
echo "backed up $DB -> $OUT"
# prune: keep newest 14 dated snapshots
ls -1t data/backups/garmin-*.db 2>/dev/null | tail -n +15 | while read -r f; do
rm -- "$f"
echo "pruned $f"
done