Skip to content

4.15.0

Compare
Choose a tag to compare
@ruheni ruheni released this 30 May 17:22
· 1350 commits to main since this release
4e0a901

馃専 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鈥檛 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:

  1. Updated the file system watcher that is responsible for restarting the TypeScript server when prisma generate is run to ensure the types are in sync

    Note:

    • 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
  2. Added Quick Fixes action for unique identifiers for MongoDB to add the @map("_id") attribute function when it鈥檚 missing on an identifier field

    Screen.Recording.2023-05-17.at.19.22.20.mov
  3. Support for renaming symbols for composite types and views

    type-symbol-rename.mov

Fixes and improvements

Prisma Client

Prisma Migrate

Language tools (e.g. VS Code)

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.