npm @prisma/client 2.13.0

latest releases: 5.21.0-dev.3, 5.21.0-integration-itx-refactor.16, 5.21.0-integration-itx-refactor.15...
3 years ago

Today, we are excited to share the 2.13.0 stable release 🎉

🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release.

Major improvements

Prisma Migrate is now in Preview

We are releasing Prisma Migrate in Preview; read the announcement blog post to learn more. This version is the evolution of the Experimental Prisma Migrate we released last year. We've changed Migrate to be more predictable and providing fine-grained control over how exactly database schema changes are carried out. You can learn more about the Preview stage in the Prisma docs.

Please try out Prisma Migrate and share your feedback for it here.

Auto-generated migrations files in plain SQL

Prisma Migrate still picks up the changes in your Prisma schema file to generate migration files. The main difference compared to the previous Migrate version is that these migration files are now plain SQL and fully customizable; this allows for:

  • More control over how exactly schema changes are performed (e.g., renaming an existing column)
  • Performing data migrations
  • Using certain database features that can't be represented in the Prisma schema (e.g., creating stored procedures or triggers)
  • Orchestration of complex changes (e.g., an expand and contract pattern)

Integrated workflows for development and production

This evolved version of Prisma Migrate is now deterministic making sure migrations are always executed in a predictable way. The tool supports both workflows for deploying migrations to production and other environments. It also comes with an interactive development command that not only helps to create and apply migrations, but also helps developers to get back on track when they run into certain issues.

Breaking changes when upgrading from the Experimental version

The new Preview version is not backward compatible with the previous Experimental version. You can learn more about the upgrade process in the docs.

Import types and enums in the browser

Until now, you could not import any typings that are generated by Prisma Client in a browser application. This changed in this release! With 2.13.0, you can now import all your enums and all types from Prisma Client in any browser environment. This also works across all the universal Javascript frameworks like Next.js, Blitz, Gatsby, and Vue.js.

Let's take a look at an example of a React component utilizing the new exports. Assume you have the following Prisma schema:

model User {
  id      String @id
  hobbies Hobby[]
}

enum Hobby {
  Tennis
  Prisma
  Basketball
}

Once you've generated the @prisma/client node module, you can import the generated types in your frontend application as follows:

import { Hobby, User } from '@prisma/client'

type Props = {
  user: User
}

export function HobbyComponent({ user }: Props) {
  return (
    <div>
      Hello {user.name}! <br />
      The available hobbies are: <br />
      <ul>
        {Object.values(Hobby).map(hobby => <li key={hobby}>{hobby}</li>)}
      </ul>
    </div>
  )
}

Lots of improvements for Prisma Studio

New keyboard shortcuts in the standalone app

Navigating tabs

You can now use your keyboard to navigate between tabs in the Prisma Studio standalone app:

  • CMD+SHIFT+[ OR CMD+OPTION+←: Navigate to left tab
  • CMD+SHIFT+] OR CMD+OPTION+→: Navigate to right tab
Expand to view Studio's keyboard shortcut cheatsheet

Zooming in and out

You can now use your keyboard to zoom in and out in the Prisma Studio standalone app:

  • CMD++ OR CMD+SHIFT++ to zoom in
  • CMD+- OR CMD+SHIFT+- to zoom out

Improved UX for inline editing of arrays

Inline editing of arrays (scalar lists) has sometimes been cumbersome with the Prisma Studio UI. With this release, we include a smoother UX for this.

Expand to view a demo of the new UX

Note that you can try out Studio with some sample datasets here.

Prisma Client Go now supports JSON

We've had JSON support in Prisma Client JS for quite a while, but we're pleased to announce that the Go version of Prisma Client now has JSON support as well. Head over to the documentation to learn more!

🌎 Join us for the second Prisma Online Meetup

Join us online for the second Prisma Meetup and learn more about the Preview version of Prisma Migrate from Alberto Perdomo and Tom Houlé who have been deeply involved building it.

  • When? December 09, 2020 6pm CET
  • Where? Youtube

Fixes and improvements

prisma

migrate

language-tools

studio

prisma-engines

Credits

Huge thanks to @qsona for helping!

Don't miss a new client release

NewReleases is sending notifications on new releases.