Skip to content
Pre-release
Pre-release

@nikolasburk nikolasburk released this Jan 21, 2020 · 306 commits to master since this release

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 (formerly lift) subcommands behind an --experimental flag
  • Removed the prisma2 dev command
  • Removed the interactive prisma2 init wizard
  • Introduced a new telemetry endpoint
  • Renamed notion of Prisma Framework back to Prisma 2
  • onDelete has been removed from the @relation attribute

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/client

Finally, 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 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?

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.

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 up

The 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 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?

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.

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:

  1. Run prisma2 init to create an empty Prisma schema file.
  2. Set your DB connection string as the url of the datasource block inside the Prisma schema.
  3. Run prisma2 introspect to test the connection and obtain your data model.
  4. Run prisma2 generate to 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.

Why was the interactive prisma2 init wizard removed?

The interactive 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.

We therefore decided to remove the wizard and opted for a simpler version of 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=1

onDelete 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

prisma-client-js

migrate

prisma-engine

Assets 2
You can’t perform that action at this time.