[recipes] Brain backup and export#193
Conversation
|
Conflicts with |
Exports Supabase tables to JSON. Hardened from code review: pagination that terminates correctly, PGRST205-only "table missing" detection, atomic writes via tmp+rename, an AbortController fetch timeout, and BOM-tolerant env parsing.
5d67ad3 to
119ac66
Compare
|
Rebased onto For review context: |
justfinethanku
left a comment
There was a problem hiding this comment.
Reviewed the recipe/code updates, added the missing community credit block, and confirmed the refreshed branch passes the visible required Actions checks. Approving for maintainer merge.
Summary
Node.js recipe that exports every Open Brain Supabase table to dated local JSON files with streaming pagination.
<table>-YYYY-MM-DD.json) for simple daily retentionthoughtsis required; optional companion tables (entities,edges,thought_entities,ingestion_jobs,ingestion_items) are backed up only if present. Stock Open Brain installs skip them cleanly instead of erroring..env.localWhy
Open Brain users accumulate thousands of thoughts over time but Supabase-side backups require plan-tier access or manual dumps. A zero-dependency Node recipe gives anyone on the free tier a scriptable backup path that runs from cron / Task Scheduler.
The optional-table handling lands specifically so this recipe works against every Open Brain install, not just ones that have also installed the entity-extraction or smart-ingest schemas. Missing companion tables return a PostgREST 404, which the script treats as "skip with a log line" rather than an error.
Part 11 of 12 in the OB1 Alpha Milestone consolidation.
Test plan
thoughtstable) — verifythoughtsbacks up, optional tables logskipped (table not present)thoughtstemporarily → verify the script throwsRequired table "thoughts" not foundthoughtsexport → verify no partial/corrupt JSON left behind (next run overwrites cleanly)node --check backup-brain.mjspassesmetadata.jsonpasses the gate schema