5.15.0
版本发布时间: 2024-06-04 23:24:08
prisma/prisma最新发布版本:5.19.1(2024-09-02 22:57:37)
Today, we are excited to share the 5.15.0
stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
Multi-File Prisma Schema support
Prisma ORM 5.15.0 features support for multi-file Prisma Schema in Preview.
This closes a long standing issue and does so in a clean and easy to migrate way.
To get started:
- Enable the
prismaSchemaFolder
Preview feature by including it in thepreviewFeatures
field of yourgenerator
.datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" previewFeatures = ["prismaSchemaFolder"] }
- Create a
schema
subdirectory under yourprisma
directory. - Move your
schema.prisma
into this directory.
You are now set up with a multi-file Prisma Schema! Add as many or as few .prisma
files to the new prisma/schema
directory.
When running commands where a Prisma Schema file is expected to be provided, you can now define a Prisma Schema directory. This includes Prisma CLI commands that use the --schema
option as well as defining schema via package.json
Our tooling has also been updated to handle multiple Prisma Schema files. This includes our Visual Studio Code extension and tools like database introspection, which will deposit new models in a introspected.prisma
file. Existing models will be updated in the file they are found.
To learn more, please refer to our official documentation and announcement blog post. If you try out prismaSchemaFolder
, please let us know!
Interesting Bug Fixes
Fix for PostgreSQL prepared statement caching for raw queries
This release fixes a nasty bug with the caching of prepared statements in raw Prisma Client queries that affected PostgreSQL when you ran the same SQL statement with differently typed paramters. This should not fail any more.
Fix for SQL Server introspection of (deprecated) CREATE DEFAULT
Our Introspection logic crashed on encountering certain multi-line CREATE DEFAULT
, a deprecated way to define defaults in SQL Server. As many SQL Server users are working with established databases, this happened frequently enough that we now explicitly ignore these defaults instead of crashing.
Fix for Cloudflare D1’s lower parameter limit
Cloudflare’s D1 has a lower parameter limit than local SQLite, which caused bigger queries to fail. We adapted that limit to the D1 default for @prisma/adapter-d1
, which will avoid such failures.
Fix for Cloudflare D1’s different PRAGMA
support
Our generated migration SQL for SQLite did not always work for Cloudflare D1, because of differences in the supported pragmas. We adapted the SQL to work in both local SQLite and Cloudflare D1.
Fixes and improvements
Prisma Migrate
- Crash on multiline defaults introspection on MSSQL
-
Error: [libs\sql-schema-describer\src\mssql.rs:315:30] called
Result::unwrap()
on anErr
value: "Couldn't parse default value:create default [dbo].[member_notification_cancel_flags] as 0\r\n
" -
Error: [libs\sql-schema-describer\src\mssql.rs:315:30] called
Result::unwrap()
on anErr
value: "Couldn't parse default value:create default d_password as 'D,73'
" -
Crash introspecting MSSQL database with
DEFAULT
s - doing introspection on a SQL Server 2018 DB - for Dynamic GP get the following error.
-
Error: [libs\sql-schema-describer\src\mssql.rs:317:30] called
Result::unwrap()
on anErr
value: "Couldn't parse default value:\r\ncreate default D_BIT_OFF\r\nas 0\r\n
" -
Error: called
Result::unwrap()
on anErr
value: "Couldn't parse default value in SQL Server -
db pull errors on SQL Server with
Error: [libs\sql-schema-describer\src\mssql.rs:336:30] called
Result::unwrap()on an
Errvalue: "Couldn't parse default value: [...]
-
Error: [libs\sql-schema-describer\src\mssql.rs:336:30] called
Result::unwrap()
on anErr
value: "Couldn't parse default value:\r\ncreate default [va_nulla] as 0\r\n
" - Error when pulling from database
- Foreign key relation results in erroneous second migration
-
db pull
can't parse script setting default value - Bug: Migrations not compatible with D1
- SQL Server Introspection crashes on multi-line (deprecated) defaults
Prisma Client
-
Raw query failed. Code:
22P03
. Message:db error: ERROR: incorrect binary data format in bind parameter 1
-
Float number on raw query:
incorrect binary data format in bind parameter 1
- Can't use Prisma client in Next.js middleware, even when deploying to Node.js
-
Prepared statement caching is data dependent on numeric input parameters (
incorrect binary data format in bind parameter x
) -
Turso Driver Adapter: Including
_count
leads to error - Next.js app build fails when using Prisma with DB driver in Server Action
- Bug: [D1] Error in performIO: Error: D1_ERROR: too many SQL variables
-
Remove
warn(prisma-client) This is the 10th instance of Prisma Client being started.
warning in Edge (and potentially) other envs) -
$executeRawUnsafe:
incorrect binary data format in bind parameter 6
- Bug: Error or bug using Prisma with DriverAdapter with PostgreSQL database Neon
-
Inconsistent column data: Unexpected conversion failure from Number to BigInt
error when using@prisma/adapter-pg
- Incompatibility with NextJS app dir, CloudFlare Pages and D1
-
Breaking change?
Int
switched to beingInt32
for MongoDB
Language tools (e.g. VS Code)
- VS Code extension is showing an advertisement
-
Generate
codelens fails on Windows - We incorrectly read commented out preview features if they are before the real preview features
Credits
Huge thanks to @pranayat, @yubrot, and @skyzh for helping!