Repository navigation
TML-3813: A Postgres migration.ts that imports the free createExtension fails with a clear error, and the rc.22 upgrade guide gives the fix - #30988
Conversation
Since rc.22 the free createExtension took a lowerer that a migration.ts
cannot supply, so the rc.21 call createExtension("x") crashed. Remove it
from the public export; migrations call this.createExtension. Add the
missing rc.21 to rc.22 recipe entry and a pending fragment for the
removal.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The free dataTransform takes an internal fourth argument that a migration.ts cannot supply, the same problem as the free createExtension. Migrations call this.dataTransform, as the planner writes it. The types stay exported. The upgrade guide entry for 8.0.0-rc.22 is renamed create-extension-takes-options, sits before contract-artifacts-restamp, and says re-running node migration.ts is not needed. The pending fragment is renamed migration-free-functions-not-exported and covers both functions. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
In 8.0.0-rc.22 the createExtension method requires schema; it became optional in 8.0.0-rc.23. The guides now write { schema: 'public', extension } and say to use the schema the extension is installed in.
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
@prisma/orm-extension-arktype-json
@prisma/orm-extension-middleware-cache
@prisma/orm-extension-paradedb
@prisma/orm-extension-pgvector
@prisma/orm-extension-postgis
@prisma/orm-extension-supabase
@prisma/orm-family-mongo
@prisma/orm-family-sql
@prisma/orm-framework
@prisma/orm-mongo
@prisma/orm-mysql
@prisma/orm-postgres
@prisma/orm-postgres-contrib
@prisma/orm-sqlite
@prisma/orm-target-mongo
@prisma/orm-target-mysql
@prisma/orm-target-postgres
@prisma/orm-target-sqlite
@prisma/orm-toolchain
commit: |
size-limit report 📦
|
Linked issue
Closes TML-3813.
At a glance
A PostgreSQL
migration.tswritten by the 8.0.0-rc.21 planner, or by hand, creates an extension with the free function:On 8.0.0-rc.22 and later,
node migration.tsfails with onlyCannot read properties of undefined (reading 'lowerToExecuteRequest'). No upgrade guide mentions it.After this PR the import fails at once, with
does not provide an export named 'createExtension', and the upgrade guides give the rewrite:Why it broke
#30902 (released in 8.0.0-rc.22) changed the free function to
async createExtension({ schema?, extension }, lowerer). Its checks are now query trees, and turning them into SQL needs the lowerer, which only the migration class has (through the Postgres control adapter). The function stayed in the public export, so amigration.tscould import it but never call it correctly. The rc.21 planner wrotecreateExtension("x")into every migration that created an extension, so planned migrations break too, not only hand-written ones.The free
dataTransformhas the same problem: its fourth argument is the control adapter. The planner writesthis.dataTransform(...), and nothing in the repository imports the free one.What this PR changes
packages/3-targets/postgres/1-target/src/exports/migration.tsno longer exports the freecreateExtensionordataTransform. The typesDataTransformClosureandDataTransformOptionsstay. The facade@prisma/orm-postgres/migrationre-exports this module, so it changes too. A new test pins the full export list.create-extension-takes-options. It detects the free call and gives the rewrite. In rc.22 the method still requiresschema, so the guide writes{ schema: 'public', extension }.upgrade-instructions/pending/migration-free-functions-not-exported/(app and extension), records the export removal for the next release.skills/prisma-8/references/migrations.mdlistscreateExtension,dropExtensionandsetExtensionSchemaas methods, and no longer listscreateExtensionas a free helper.prisma db migrateappliesops.jsonand never loadsmigration.ts, so applied migrations keep working. The rewrite runs the same SQL as rc.21 (CREATE EXTENSION IF NOT EXISTS "btree_gist"), so no migration needs to be planned again.Testing
packages/3-targets/postgres/1-target/test/migrations/migration-exports.test.tsfails onmain(the list containscreateExtensionanddataTransform) and passes here.test/integration/test/upgrade-instructions/migration-free-functions-not-exported/detection.test.tschecks every new detection: a free call or import matches,this.createExtension(...), type-only imports and the MongoDBdataTransformdo not.createExtensionordataTransformfromdist/migration.mjsfails withdoes not provide an export named ….pnpm check:upgrade-coverage --mode prandpnpm lint:ratchetspass.Alternatives considered
extension.xwould then have two shapes. Rejected.Agent: portia-43
Summary by CodeRabbit
createExtensionanddataTransformfunctions. Use the corresponding migration class methods instead; migration-related types remain available.ops.jsonfiles do not need to be regenerated.