๐ Help us spread the word about Prisma by starring the repo or tweeting about the release. ๐
Highlights
For this release, we focused on fixing bugs and making smaller quality-of-life improvements.
Support for custom arguments for prisma db seed
This release adds support for defining and passing arbitrary arguments to prisma db seed
. This creates the opportunity for you to define your own arguments in your seed file that you could pass to the prisma db seed
command. A few example use-cases include, but are not limited to:
- Seeding different data in different environments
- Partially seeding data in some tables
Here is an example seed.ts
file that defines custom arguments for seeding different data in different environments:
// prisma/seed.ts
import { parseArgs } from "node:util";
const options = {
environment: { type: 'string', },
}
async function main() {
const { values: { environment } } = parseArgs({ options })
switch (environment) {
case "development":
/** do something for development */
break;
case "test":
/** do something for test environment */
break;
default:
break;
}
}
main()
You can then provide the environment
argument when executing the seed script as follows:
npx prisma db seed -- --environment development
Let us know what you think, share example usage of this feature, and create a bug report if you run into any issues.
Improved error messages when Query Engine file is not found
This release improves the error messages returned by Prisma Client when the Query Engine file is not found. A few reasons the Query Engine file might be missing from your application bundle include when:
- The downloaded Query Engine doesnโt match the runtime/ target platform your application is running on.
- The Query Engine is not copied to your final application bundle during the build step.
We hope these error messages are helpful while debugging your application.
Prisma VS Code extension improvements
In this release, we made a few improvements to our VS Code extension:
-
Updated the file system watcher that is responsible for restarting the TypeScript server when
prisma generate
is run to ensure the types are in syncNote:
- This new approach is currently only available on Windows and Linux. We plan on adding support for the new file system watcher on macOS soon.
- This requires both Prisma CLI & VS code extension version
4.15.0
or higher
-
Added Quick Fixes action for unique identifiers for MongoDB to add the
@map("_id")
attribute function when itโs missing on an identifier fieldScreen.Recording.2023-05-17.at.19.22.20.mov
-
Support for renaming symbols for composite types and views
type-symbol-rename.mov
Fixes and improvements
Prisma Client
- Prisma generate -
Error: write EPIPE
on WSL <-> Windows prisma generate
is blocked byquery-engine-rhel-openssl-1.0.x
opening in Notepad on Windows- Generated client output path hardcoded to build environment
- Issue with Yarn Workspace Monorepo: Query engine binary for current platform could not be found.
- Cloning a project with checked in
node_modules
(from another platform) leads to platform engine not being present - SvelteKit, Vite and Prisma "module not defined"
- Schema File Not Found in non monorepo with custom
output
- Deploying to Cloudflare Workers | "PrismaClient is unable to be run in the browser"
- Inline/bundle the contents of the prisma schema on generate
- Netlify:
Query engine library for current platform "rhel-openssl-1.0.x" could not be found. You incorrectly pinned it to rhel-openssl-1.0.x
- Query Engine Library Not Found
- No client schema when using PrismaClient during cached (standard) Netlify build
- Module "@prisma/client" has no exported member "PrismaClient"
- EPERM: operation not permitted
- prisma/client crashes when used with older versions of react-refresh
- Unable to run prisma cli in pnpm monorepo from workspace install
- Misleading error message when the query engine is not found
- When setting custom client output directory, generated package.json does not include "sideEffects: false"
- You already added the platform "debian-openssl-1.1.x" to the "generator" block in the "schema.prisma" file as described in https://pris.ly/d/client-generator, but something went wrong.
- Prisma seems to be looking in the wrong location for rhel-openssl-1.0.x
- Can't find prisma engine
Cannot find name '$PrismaModel'
due to featureextendedWhereUnique
with preview featurefieldReference
- Netlify build fails with PrismaClientInitializationError
- i'm getting the error while requesting the api
- Query engine library for current platform could not be found.
- Prisma unable to reconnect if initial connection fails
- GraphQL protocol encoder incorrectly turns empty array into empty object.
- GraphQL protocol: Invalid
Date
values silently turn intonulls
- @prisma/client/edge + Cloudflare Worker / wrangler = Could not resolve "os"
- Client is bricked from connecting to DB if first attempt fails.
- JSON protocol: incorrect recursive composites detection through multiple nesting levels
fieldReference
is not working with enums
Prisma Migrate
- Pass extra arguments to
prisma db seed
to the seed command - Typo in generating migration SQL to add enum.
Language tools (e.g. VS Code)
- MongoDB: Quick fix for missing
@map("_id")
annotation - Rename composite types
- Views: Support for rename
- TextDocument deprecation
- Lib name change vsce -> @vscode/vsce
Credits
Huge thanks to @RobertCraigie, @KhooHaoYit, @art049, @luxaritas, @mrazauskas, @maxmartynov, @haneenmahd for helping!
๐บ Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, June 1 at 5 pm Berlin | 8 am San Francisco.