chore(db): upgrade PGlite 0.2.17 → 0.5.4#74
Merged
Merged
Conversation
The 0.2 → 0.5 jump changes the embedded Postgres version, so the on-disk format is incompatible — a straight bump can't open the existing store. Migrated the live store across the boundary with the logical backup/restore path (backup → swap store aside → restore into a fresh 0.5.4 store); the old store is kept at data/pgdata.pre-0.5.4 as the rollback. App-compat verified in an isolated worktree under 0.5.4 before flipping: boot, migrations, drizzle read/write, the `live` extension (sync snapshot + write→delta), PTY, and a dispatch dry-run all pass. Live store now runs 0.5.4 with all data intact. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaP4r6ZvUYwABKLvEy2ZRp
…rwise) PGlite 0.5.4 exits the process with code 99 when its client is left open at exit — so every db.ts-importing test (which opens the module client on a throwaway store and never closes it) failed the suite, even with all assertions passing. 0.2.17 exited cleanly, so this only surfaced with the bump. Add a `bun test --preload` teardown that closes the client after each file, guarded to a temp PM_DATA_DIR so it never touches the live store. No production-code change; the server never exits, so leaving the client open stays inert there. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaP4r6ZvUYwABKLvEy2ZRp
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.
Upgrades
@electric-sql/pglite0.2.17 → 0.5.4.Why it's not a plain version bump
The
0.2 → 0.5jump changes the embedded Postgres version, so the on-disk format is incompatible — a 0.5.4 server literally can't open a 0.2.17 store (verified: "failed to initialize"). The store has to be migrated across the boundary.How the live store was migrated
Using the logical backup/restore path from #59 (version-independent by design):
The old store is kept at
data/pgdata.pre-0.5.4as the rollback (downgrade the dep, move it back). All 612 rows / 11 tables carried over intact.App-compat, verified before flipping
Ran an isolated-worktree spike under 0.5.4 (live supervisor untouched on 0.2.17 throughout) exercising every pglite-dependent path:
live+ drizzle load)liveextension — sync snapshot + write→deltaThen flipped the live store and re-verified on it: health, data intact (
m166/m199present),/backup, and a live/syncsnapshot all green on 0.5.4.Diff is just
package.json+bun.lock; the migration is an operational step (done), not code.