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
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.
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
- Expand --version command
- Generating client to custom location with Next.js is broken
- Expose types to the frontend for Next.js
- Adjust
prisma init
to write to .env instead of prisma/.env - Native Types Postgres: Introspecting timestamp[] and time[] break client generation
- Understand Prisma $connect behavior
deleteMany
should be valid without parameters- sqlserver Introspection Fails With "No such table: information_schema.columns" Based on Case Sensitive Database Collation
- Allow
deleteMany
without args in TypeScript - Make Prisma Client (usage + generation) ASAR compatible
- Add
Symbol.toStringTag
to Prisma Client - Breaking change: Error classes are exported as types
- Deprecated types are not seen as such
- Adjust wording of comment when
dbgenerated()
is added via introspection - Hint for codemod should highlight command in backticks and/or colored
- XOR introduces regression in type safety
migrate
language-tools
- Connection to server got closed. Server will restart
- VC Code extension stopped working
- Rename doesn't rename multiple models of the same relation
- Syntax highlighting broken for Json and Float field
studio
- Editing of enum & boolean lists is sub-par
- Opened a non-existing project from the history and can't restart Studio
- Zoom in/out with keyboard shortcuts
prisma-engines
- Supporting SQL Server in Migration Engine
- Return a user-facing error for database URL parsing errors.
- CI: Find a reliable way to shut down docker after the tests have finished
Credits
Huge thanks to @qsona for helping!