Today, we are issuing the twentieth Preview release: 2.0.0-preview020 (short: preview020).
This release has a number of major and breaking changes, be sure to read the notes below before upgrading!
The most important changes are:
- Renamed Photon.js to Prisma Client JS (or just Prisma Client)
- Renamed Lift to Prisma Migrate
- Moved Prisma's
migrate(formerlylift) subcommands behind an--experimentalflag - Removed the
prisma2 devcommand - Removed the interactive
prisma2 initwizard - Introduced a new telemetry endpoint
- Renamed notion of Prisma Framework back to Prisma 2
onDeletehas been removed from the@relationattribute
To see how the changes affect an application, check out the updated examples.
⚠️ If you're using Prisma together with GraphQL Nexus and nexus-prisma, check out the additional release notes of nexus-prisma: https://github.com/prisma-labs/nexus-prisma/releases/tag/0.7.0
Breaking changes
Photon.js has been renamed to Prisma Client JS
Aside from the renaming throughout all our content resources, this change is breaking the generator definition in your Prisma schema. Instead of using photonjs as the provider of your generator, you now need to use prisma-client-js:
generator client {
- provider = "photonjs"
+ provider = "prisma-client-js"
}The Prisma Client's npm package has also been renamed. Instead of installing @prisma/photon, you're now using @prisma/client:
- npm install @prisma/photon
+ npm install @prisma/clientFinally, the way how you import Prisma Client in your code and instantiate it needs to be adjusted too:
- import { Photon } from '@prisma/photon'
+ import { PrismaClient } from '@prisma/client'
+ // const { PrismaClient } = require('@prisma/client')
- const photon = new Photon
+ const prisma = new PrismaClient()Note that the former We renamed Photon.js in an effort to make Prisma simpler. Instead of using abstract names for the Prisma tools, we've decided to use descriptive names for the different parts of Prisma to make it easier for newcomers to understand what each of our tools does.
photonjs repo is now called prisma-client-js. We also removed the former Photon.js website on https://photonjs.prisma.io and are redirecting it to these release notes.
Why was Photon.js renamed?
Lift has been renamed to Prisma Migrate and is now behind an --experimental flag
Prisma's lift subcommand has been renamed to migrate:
- prisma2 lift save
- prisma2 lift up
+ prisma2 migrate save
+ prisma2 migrate upThe initial launch of Prisma 2 in February will include only Prisma Client, but not yet Prisma's migration tooling. To anticipate this split, all migration-related functionality of the prisma2 CLI now requires an explicit opt-in via an --experimental flag:
prisma2 migrate save --experimental
prisma2 migrate up --experimental
Note that the former We renamed Lift in an effort to make Prisma simpler. Instead of using abstract names for the Prisma tools, we've decided to use descriptive names for the different parts of Prisma to make it easier for newcomers to understand what each of our tools does.
lift repo is now called migrate. We also removed the former Lift website on https://lift.prisma.io and are redirecting it to these release notes.
Why was Lift renamed?
Removing prisma2 dev
The prisma2 dev command has been removed from the Prisma 2 CLI. If you want to automatically re-generate Prisma Client upon a schema change, you can now add the --watch flag on the generate command:
prisma2 generate --watch
Why was prisma2 dev removed?
The prisma2 dev command was removed because it was using Prisma's migration functionality under the hood. Since migrations are considered experimental as of this release, we wanted to make sure that the main Prisma worfklows are not using them any more. Note that in the future we will provide an even better experience for developers who liked the quick turnaround time of prisma2 dev.
Removing the interactive prisma2 init wizard
The prisma2 init command has been simplified. It now only outputs a basic schema.prisma file with some helpful comments that explain potential next steps. A typical "getting started" flow now looks as follows:
- Run
prisma2 initto create an empty Prisma schema file. - Set your DB connection string as the
urlof thedatasourceblock inside the Prisma schema. - Run
prisma2 introspectto test the connection and obtain your data model. - Run
prisma2 generateto generate Prisma Client.
You can then start using Prisma Client in your application:
import { PrismaClient } from 'prisma-client-js'
// or const { PrismaClient } = require('prisma-client-js')
const prisma = new PrismaClient()Learn more in the updated "Getting Started"-guide.
If you want to get started with a new project instead of using an existing database, check out the available examples.
The interactive We therefore decided to remove the wizard and opted for a simpler version of Why was the interactive
prisma2 init wizard removed?
prisma2 init wizard was a very ambitious command to support developers in setting up their Prisma-based projects. While it helped some developers get started with an initial setup, it also showed to be very complex, confusing and difficult to maintain.
prisma2 init that just sets up an initial Prisma schema file for you.
Introducing a new telemetry endpoint
To improve the Prisma tools, we've created a new telemetry endpoint. This endpoint is pinged by the prisma2 CLI upon the invokation of any command. Note that after the endpoint got pinged once, the pinging is paused for 48 hours before the next ping is sent from a command invokation. Learn more about the new telemetry server and the data it's sending in the docs.
You can opt-out of this behavior by setting the CHECKPOINT_DISABLE environment variable to 1, e.g.:
export CHECKPOINT_DISABLE=1onDelete has been removed from the @relation attribute
While not causing an error, the onDelete argument on the @relation attribute didn't have any effect (i.e., it hadn't been implemented yet). To make the API surface simpler, we removed it from the Prisma schema for now.
Other changes
Renaming Prisma Framework to Prisma 2
We also decided to rename the Prisma Framework to Prisma 2 (or just "Prisma") again. The main reason for this is that many developers got confused about the term "framework" and misinterpreted it as a "web application framework" when it was supposed to refer to a "database framework". To prevent this confusion in the future, we decided to remove the "Framework"-part from its name.
As of now, we're still mainly referring to it as Prisma 2. After the initial launch in February, Prisma 2 will be referred to as just "Prisma".
Fixes and improvements per Prisma Framework repository
prisma2
- [Introspection] Error: Schema parsing
- [Introspection] dot (and other non-[a-z0-9] characters) in field name
- ENOENT error when running prisma as /api in next.js
- ManyToMany pivot table
- Use jszip instead of adm-zip to zip error reports
- [Feature Request] Default to public schema when using postgresql
- Back button does not work on init flow with SQLite selected
init, Introspection: Tells me that schema is not empty, does not even exist thoughinit: Starter Kit flows only show empty databasesinit: Input is not disabled while connecting to databaseprisma2 generatekeeps downloading query engine (or at least tells me it does)init: Back button is not working- Support NO_COLOR env var to strip color from output
prisma2 init, first step is labeled "Languages for starter kits"init: Wrong "Back" detail- README should be removed from
Blank project-> ... ->Demo scriptoption - Defaults are not being used in the new init flow
prisma2 initnavigation infinite loop- Visibility into DB queries generated by Photon
- Add transactions to contents
prisma2 generatetries to install@prisma/photoneven in folder withoutpackage.json- ENV Variables with SQLite
- [Introspection] Support non-alphanumeric characters in model names
- [Introspection] Support non-alphanumeric characters in field names
- Docs: Prisma schema link leads to a
not foundpage - Document @@index
- Report Introspection errors to Error Reporting Backend
- Provided database name is ignored in prisma init
- Invalid photon provider results in a silent error
- Introspection documentation could mention
--url - [Introspection]
?is not accepted as character in column name - [Introspection]
(is not accepted as character in column name - [Introspection] Space is not accepted as character in column name
- [Introspection]
-is not accepted as character in column name - [Introspection]
/is not accepted as character in column name - [Introspection] Fields and models starting with numbers should be valid
- CLI init always reports that dependencies are installed via npm
- Add generate --watch to CLI
- New, simpler
init - Remove
dev - --experimental + lift => migrate
- prisma2 generate is trying to download from incorrect url (debiandebian-openssl-1.1.x/prisma.gz)
- Docs for working with types
- Fixed npm package installation command syntax
- CLI tries to download npm packages using
npm add - Introspection failed with "Please wait until the 'prisma query-engine' download completes! / SyntaxError: Unexpected token P in JSON at position 0"
- Listen for
--helpto print help inprisma2 init
prisma-client-js
- Filtering by ENUM type
- Photon Zeebe bug (prototype pollution?)
- Adding
new Photonin the lambda function context stops the engine - Allow reconnecting after disconnect
- Runtime validation error on
orderBy: nullmany query - Turn off pretty errors
- Second default(now()) doesn't work
- Photon and undefined target="exit" error
- Error when trying to filter multiple fields of a many-to-many relationship within a where clause
- fix: correct typo
- Add logging for Photon time vs. Query Engine time
- Unable to apply 'where' arguments beyond (3rd?) level
- fix(photon): allow reconnecting after disconnect
- Photon's query engine process characteristics
- Add direct link to prisma-examples repo
- Add README Improvement
- TSClient: Exposes model select/include utility types
- Expose the
*GetSelectPayloadand*GetIncludePayloadutility types - Fix typo
migrate
- keep comments intact when masking schema
- Lift save/up hangs at creating SQLite db
- Fix help messages in CLI
- --auto-approve is unknown when lifting down
- Remove unused option from Lift Down help
- Listen for
--helpargument to print help onprisma2 dev
prisma-engine
- Benchmark Effects of Removing Implicit Ordering by Id
- Extend Destructive Changes: Warn if default is removed from an underlying column
- Investigate created_at getting migrated without intervention
- Change an INFO log to a DEBUG log
- Performance monitoring: return time spent in the engine
- Avoid unnecessary migrations due to ambiguous defaults on optional fields