Include data/drafts.db so other machines don't need to re-run expensive Claude API calls (~$3+ of analysis, 474 drafts, 403 authors, 1262 ideas, 12 gaps). Add scripts/db-export.sh and scripts/db-import.sh for portable compressed SQL dump sharing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
495 B
Bash
Executable File
21 lines
495 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Export drafts.db as compressed SQL dump for portable sharing.
|
|
# Usage: scripts/db-export.sh [output_path]
|
|
|
|
set -euo pipefail
|
|
|
|
DB="data/drafts.db"
|
|
OUT="${1:-data/drafts.sql.gz}"
|
|
|
|
if [[ ! -f "$DB" ]]; then
|
|
echo "Error: $DB not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Exporting $DB → $OUT"
|
|
sqlite3 "$DB" .dump | gzip -9 > "$OUT"
|
|
|
|
SIZE=$(du -h "$OUT" | cut -f1)
|
|
TABLES=$(sqlite3 "$DB" "SELECT count(*) FROM sqlite_master WHERE type='table';")
|
|
echo "Done: $SIZE ($TABLES tables)"
|