Today, we are issuing the fourth Beta release: 2.0.0-beta.4
(short: beta.4
).
Major improvements
Support for JSON types in PostgreSQL and MySQL
Prisma now supports working with JSON data with the new Json
type in the Prisma data model.
Here's an overview of how it works with different Prisma tools/workflows:
Introspection
The prisma introspect
command maps the following column types to Json
:
- Postgres:
JSON
andJSONB
- MySQL:
JSON
Prisma Migrate
prisma migrate
uses the following data type when creating a column for a field of type Json
:
- Postgres:
JSONB
- MySQL:
JSON
Prisma Client
Fields of type Json
will be exposed as plain JavaScript objects in the Prisma Client API.
Introducing prisma format
From now on, you can run prisma format
in your project, to make your schema.prisma
pretty without the VSCode extension 💅
Support for Yarn workspaces
Prisma now supports Yarn workspaces 🎉
Making Prisma Client generation more robust with .prisma
folder
The generation of Prisma Client into node_modules
sometimes caused problems with package managers (e.g. Yarn) which would occasionally delete the generated code.
In order to make the generation more robust, Prisma Client is now generated into a folder called node_modules/.prisma
. Because of the leading dot in the folder name, package managers do not touch the folder any more. This results in the following folder structure:
node_modules/
↪ .prisma
↪ client
↪ schema.prisma
↪ index.js
↪ index.d.ts
↪ query-engine-darwin
↪ @prisma/client (imports the generated code from `.prisma`)
Note that the generated Prisma Client code in .prisma
is now imported into @prisma/client
which means there is no change for how you import and use Prisma Client in your code! You can still import Prisma Client as before with:
import { PrismaClient } from '@prisma/client'
Open Prisma Studio in specific browser
The prisma studio --experimental
command now accepts a --browser
option to let you choose your preferred browser for Prisma Studio, e.g.:
prisma studio --browser "Google Chrome" --experimental
Here's an overview of the browser names you can use per platform (note that double quotes are required when the browser name contains space and the right capitalization is required too):
OS | Browser | Argument for --browser
|
---|---|---|
Mac OS | Chrome | "Google Chrome"
|
Firefox | "Firefox"
| |
Firefox (Developer) | "Firefox Developer Edition"
| |
Safari | "Safari"
| |
Windows | Chrome | "Google Chrome"
|
Firefox | "Firefox"
| |
Firefox (Developer) | "Firefox Developer Edition"
| |
Brave | "Brave"
| |
Linux | Chrome | "google-chrome"
|
Firefox | "firefox"
| |
Firefox (Developer) | "firefox-developer-edition"
| |
Brave | "brave"
|
Fixes and improvements
prisma
- Data type JSON
- beta.3 (#1635) breaks custom binaries (on Alpine)
- Investigate GCR Panic
- RUST error, Did not find a relation for model UserDetail and field userid, Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace. - Difficult to read error report
- Query by unique constraint missing included properties
- Update Prisma 1 docs to link to Prisma 2 docs
introspect
fails on SQLite
prisma-client-js
- Does not work with yarn workspace
- Type Generation : returned payload type on upsert not using include
- Providing
null
for a nullable relation results in error - Error when setting a relation field to
null
migrate
vscode
- Saving adds random fields to model
- Context-aware auto-completion
- Modelname being formatted as lowercase when auto-creating back relations
- Extension should report failure if formatting / binary execution fails
- Rename "Automatic Publish"
- Show error in VS Code extension when illegal model name is used
alpha
version of extension- Multiple versions (e.g. 0.0.21 and 0.0.22) are missing Git tags
- Clickable Schema (Relations)
- Automated testing
Credits
Huge thanks to @Sytten for helping!