[recipes] Brain backup and export#193
Open
alanshurafa wants to merge 1 commit into
Open
Conversation
Collaborator
Author
|
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
Collaborator
Author
|
Rebased onto For review context: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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