Skip to content

feat: rebuild the PostgreSQL query store from JSON source data - #183

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-149
Aug 31, 2026
Merged

feat: rebuild the PostgreSQL query store from JSON source data#183
atomantic merged 1 commit into
mainfrom
claim/issue-149

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Adds a PostgreSQL writer that rebuilds the staged query store directly from the family-tree JSON source, transactionally and idempotently.
  • Loads person JSON via a new json-tree-loader, syncs canonical person identities through postgres-person-sync, and writes through a typed postgres-writer surface.
  • Wires the rebuild into scripts/rebuild.ts / scripts/index.ts and documents the flow in docs/cli.md and docs/development.md.
  • SQLite/JSON stays the live runtime — this only populates the staged PostgreSQL store, so the migration remains reversible.

Test plan

  • npm run build -w shared && npm run test:unit — 14 files, 150 tests pass.
  • tests/integration/db/postgresWriter.spec.ts covers a full rebuild against a throwaway schema, asserting row counts, canonical identity preservation, and idempotency on a second run. It self-skips unless SPARSETREE_TEST_DATABASE_URL is set.

Closes #149

@atomantic
atomantic merged commit 513d710 into main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rebuild the PostgreSQL query store from JSON source data

1 participant