Repository navigation
[db] Move to postgres.js 4 - #102
Merged
Merged
Conversation
postgres 3.4.9 -> 4.0.0 in apps/web. v4 rewrites the pool, protocol and socket layer below an unchanged API; on Workers it uses cloudflare:sockets through its workerd export condition, and the API bundle grows from 708 to 731 KiB gzip. apps/evals now declares postgres too: it imports drizzle-orm, whose peer had resolved to postgres 3 there and 4 in apps/web, giving two copies whose SQL types did not mix (evals typecheck failed). v4 lets the server type every parameter, so a Date meets a timestamp or date column as UTC. That does not reach the kit: all 42 timestamp columns are withTimezone: true and no query passes an untyped Date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
postgres.js, the
postgresdriver behindopenDatabase, moves from3.4.9to4.0.0. v4 rewrites the pool, protocol and socket layer below an unchanged API.Why
apps/evalsgains the dependency: it importsdrizzle-orm, whosepostgrespeer resolved to 3.4.9 there and 4.0.0 inapps/web. pnpm then installs two copies of Drizzle, and theirSQL<…>types don't mix, so the evals typecheck failed. Declaring it gives onedrizzle-orm@0.45.4(postgres@4.0.0), and nopostgres@3is left in the lockfile.What v4 changes and how it reaches the kit:
Datemeets atimestamp/datecolumn as UTCwithTimezone: true, there are nodate()columns, and the SQL templates compare columns withnow(), not with rawDatevalues.sql.array()removedworkerdexport condition oncloudflare:socketsbuild:apisucceeds. The API bundle grows from 708 to 731 KiB gzip.The options and hooks the seam relies on still work in v4:
prepare: falseandfetch_types: falseare applied at runtime, andclient.options.parsersis still the mapARRAY_PARSERSmerges into.tests/driver/driver.test.tsround-tripstext[],int[],bigint[]andbool[]through those parsers.Evidence
apps/evalstypecheck fails with 11drizzle-ormtype errors from the two copies.After:
pnpm gatepasses on Node 26.13.0: api 638, the other web projects 1807 + 5 skipped, driver conformance under neon 13, cli 58, evals 25, andbuild:apisucceeds.kit.yml's plugins job in a throwaway worktree (analytics 3.4.2,GATE_SUITE_DRIVER=neon). All green: api 685 including the plugin's cube-isolation tests, the other web projects 1859, driver 13.unsafe()cast, the plugin's source) were checked locally as above.Merge Danger
Door: two-way
Blast Radius: database
Every query goes through the new pool and protocol. The conformance suite and the full suite under both drivers are the evidence; nothing in the kit's own code changes.
🤖 Generated with Claude Code