Repository navigation
Closed
Labels
Description
Switching an existing project from postgres to @steadybrew/postgresjs should be one command that makes the switch and reports what to check, published to the Codemod registry as npx codemod @steadybrew/postgresjs-migrate.
Switch (the only auto-fix)
- Add the npm alias in
package.json:"postgres": "npm:@steadybrew/postgresjs@^4". The alias is preferred over rewriting imports because Drizzle (drizzle-orm/postgres-js,drizzle-kit),kysely-postgres-jsand the tracers all match the namepostgres. - Check the Node version (22 or newer) in
engines,.nvmrc, Dockerfiles and CI files.
Static checks, reported with file and line
- Code that 4.x behaviour changes affect: handles used after
release()or afterbegin()returns,fetch_types: falsewith arrays, transactionsql.prepare(name)names, and code that expects a hang or a specific error where the fork now rejects withCONNECTION_ENDED,COPY_IN_PROGRESSorTRANSACTION_ROLLED_BACK. - Workarounds the fork makes unnecessary:
Promise.racequery timeouts, a customjsonserializer for Drizzle, andpatch-packagepatches ofpostgres.
Runtime check for value serialization
Static analysis can't see column types, so the report recommends running with parameter_types: 'warn' in staging or production for a few days (#41, #42, #43). Zero warnings is the signal to switch to 'client'.
Tracing check
Detect dd-trace and @sentry/node (and other @sentry/* server SDKs) and say what the switch means for database spans:
- dd-trace matches the alias by path and version
>=3.0.0; spans match upstream from 4.5.0 on. Under the scoped name without the alias there are no spans. - Sentry's automatic integration targets
postgres>=3.0.0 <4, so it records no spans on 4.x. Offer to add the README'ssentry-postgres.mjspreload, which widens that range before Sentry registers its hooks, and the--importflag that loads it first. Under pnpm, also add@sentry/server-utilsat the@sentry/nodeversion.
Done when
- The codemod runs against a sample project using Drizzle, one using Kysely and one using plain
postgres, and each test case checks its report. - It is published to the Codemod registry with trusted publishing from this repository.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsShipped
Activity
feat: switch a project to the fork with --switch
okomarov commentedon Oct 18, 2026
Shipped as
@steadybrew/postgresjs-migrate0.1.0, on npm and on the Codemod registry:postgresamong them) whose reports are checked on every change. Installs with npm, pnpm and yarn after--switchare checked to load the fork, including a dependency that brings its ownpostgres.migrate-v*tags stage new versions on npm through trusted publishing and publish to the Codemod registry with GitHub OIDC. 0.1.0 was published once by hand, because npm only lets a package that already exists set up trusted publishing, so it has no provenance; later versions do.--switchlinks the README's preload. It does not write the preload into the project.