Prisma

Latest version: v0.15.0

Safety actively analyzes 717349 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 26 of 44

2.0.0preview025

Today, we are issuing the twenty-fifth [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview025` (short: `preview025`).

Breaking changes

Renaming the `prisma2` npm package

With this release, **we're renaming the Prisma 2 CLI npm package from `prisma2` to `prisma/cli`**. Note that you can still invoke the CLI using the `prisma2` command!

To upgrade, you first should uninstall the current `prisma2` version and then install the `prisma/cli` package.

Local installation (recommended)

The local installation is generally preferred since it prevents conflicting versions of the same package.

sh
Uninstall current `prisma2` CLI (`preview024` or earlier)
npm uninstall prisma2

Install new `prisma2` CLI via `prisma/cli` npm package
npm install prisma/cli --save-dev

Invoke the CLI via `npx`
npx prisma2


Global installation

sh
Uninstall current `prisma2` CLI (`preview024` or earlier)
npm uninstall -g prisma2

Install new `prisma2` CLI via `prisma/cli` npm package
npm install -g prisma/cli

Invoke the CLI via `npx`
npx prisma2


Other

- The `prisma2 --version` output changed
- Virtual relation fields (aka “back-relation fields”) follow the same name as the model they relate to during introspection
- The default for `errorFormat` in the `PrismaClient` constructor now is `colorless`

Fixes and improvements per Prisma 2 repository

`prisma2`

- [feat(prisma2/cli): allow arbitrary generator commands with flags](https://github.com/prisma/prisma2/issues/1933)
- [Update docs to reflect existing examples](https://github.com/prisma/prisma2/issues/1919)
- [Comments in schema's `datasource` block fail with `Error: Schema parsing error: Unexpected token. Expected one of: End of block ("}"), alphanumeric identifier`](https://github.com/prisma/prisma2/issues/1905)
- [get-config gets the datamodel from the env vars](https://github.com/prisma/prisma2/issues/1891)
- [Relation table for implicit m:n-relation not recognized by introspection](https://github.com/prisma/prisma2/issues/1885)
- [update postgres integration tests](https://github.com/prisma/prisma2/issues/1879)
- [[Introspection] `error: Argument 'value' is missing in attribute 'default'.`](https://github.com/prisma/prisma2/issues/1865)
- [add instructions for adding bug reports](https://github.com/prisma/prisma2/issues/1857)
- [Investigate if we can hide GraphQL Playground on CSB](https://github.com/prisma/prisma2/issues/1845)
- [Remove AUMFIDARR guardrails](https://github.com/prisma/prisma2/issues/1837)
- [Failed to validate the query `Error occurred during query validation & transformation`:](https://github.com/prisma/prisma2/issues/1820)
- [PostgreSQL: "incorrect binary data format in bind parameter x"](https://github.com/prisma/prisma2/issues/1817)
- [[Introspection] Comment out all unsupported column types](https://github.com/prisma/prisma2/issues/1812)
- [MySQL: "DateTime value not stored as DateTime, Int or string"](https://github.com/prisma/prisma2/issues/1792)
- [sqlite/chinook returns `PANIC: Could not parse stored DateTime string: 2009-01-01 00:00:00: ParseError(Invalid)` on findMany()](https://github.com/prisma/prisma2/issues/1763)
- [AWS Lambda timed out](https://github.com/prisma/prisma2/issues/1754)
- [Don't expose GraphQL Playground](https://github.com/prisma/prisma2/issues/1743)
- [[Introspection] Guardrail: Remove default values we do not support](https://github.com/prisma/prisma2/issues/1695)
- [[Introspection] Relation guardrail creates duplicate fields](https://github.com/prisma/prisma2/issues/1693)
- [[Introspection] Decide on a way forward for introspection of types our internal type system currently cannot represent](https://github.com/prisma/prisma2/issues/1690)
- [Schema Validation fails with panic `thread 'main' panicked at 'Expected ID field ... to be present on the model'`](https://github.com/prisma/prisma2/issues/1681)
- [Remove opinionated casing for back relation field names](https://github.com/prisma/prisma2/issues/1851)
- [Unclear rust error PANIC](https://github.com/prisma/prisma2/issues/1671)
- ["Oops. We could not send the error report."](https://github.com/prisma/prisma2/issues/1649)
- [[Introspection] "The model 'x' cannot be defined because a model with that name already exists."](https://github.com/prisma/prisma2/issues/1504)
- [[Introspection] Crashes when default value contains line breaks](https://github.com/prisma/prisma2/issues/1382)
- [Expand --version command](https://github.com/prisma/prisma2/issues/1196)
- [[Introspection] "created_at timestamp with time zone not null default now()" doesn't work](https://github.com/prisma/prisma2/issues/1104)
- [[Introspection] ID = (Scalar, RelationField)](https://github.com/prisma/prisma2/issues/1112)
- [Explicit many to many relationships with/without extra columns](https://github.com/prisma/prisma2/issues/816)
- [`default` doesnt work for enum](https://github.com/prisma/prisma2/issues/33)


`prisma-client-js`

- [Fix .raw with parameters for PostgreSQL](https://github.com/prisma/prisma-client-js/issues/598)
- [Using raw queries with tagged template literals doesn't include parameters](https://github.com/prisma/prisma-client-js/issues/595)
- [Fix downloading HTTPS file with HTTP proxy](https://github.com/prisma/prisma-client-js/issues/584)
- [Change default error formatting from `pretty` to `colorless`](https://github.com/prisma/prisma-client-js/issues/579)
- [Some models return `Error parsing GraphQL query: query parse error: Parse error at 4:3 Unexpected`}[Punctuator]` Expected `Name from `findMany({})` after introspection](https://github.com/prisma/prisma-client-js/issues/577)
- [Can't query models without scalar fields](https://github.com/prisma/prisma-client-js/issues/569)
- [prisma2 generate always uses yarn even if you're using NPM in your project](https://github.com/prisma/prisma-client-js/issues/561)
- [Cannot find module 'prisma/client' after installing a new package via NPM](https://github.com/prisma/prisma-client-js/issues/560)
- [Mutating a `Float` sometimes results on sightly different value written to Postgres](https://github.com/prisma/prisma-client-js/issues/555)
- [Export the current Prisma version](https://github.com/prisma/prisma-client-js/issues/573)
- [Using a relation as id or in unique doesn't work](https://github.com/prisma/prisma-client-js/issues/534)
- [Some models return `undefined` from `findMany({})` after introspection](https://github.com/prisma/prisma-client-js/issues/530)
- [3 way join with id failing when querying](https://github.com/prisma/prisma-client-js/issues/502)
- [find by composite primary keys API is super weird](https://github.com/prisma/prisma-client-js/issues/489)
- [Can't findOne, update, delete on composite primary keys](https://github.com/prisma/prisma-client-js/issues/488)
- [Find by a null time doesn't work](https://github.com/prisma/prisma-client-js/issues/486)
- [Find with exact DateTime input doesn't work with findMany or findOne](https://github.com/prisma/prisma-client-js/issues/485)
- [Gracefully handle incorrect id column type](https://github.com/prisma/prisma-client-js/issues/456)
- [Nested writes don't work on 3rd level with required relation](https://github.com/prisma/prisma-client-js/issues/275)


`prisma-engines`

- [[WIP] new relation validations](https://github.com/prisma/prisma-engines/issues/619)
- [Fix unused value warning in test](https://github.com/prisma/prisma-engines/issues/617)
- [Set the pool constraints in QE](https://github.com/prisma/prisma-engines/issues/616)
- [Health check fixes](https://github.com/prisma/prisma-engines/issues/614)
- [Test unique fields as ID on postgres](https://github.com/prisma/prisma-engines/issues/613)
- [New relations in the migration engine](https://github.com/prisma/prisma-engines/issues/612)
- [[WIP] IE Changes](https://github.com/prisma/prisma-engines/issues/610)
- [Unify dml error handling](https://github.com/prisma/prisma-engines/issues/609)
- [Test postgres array defaults](https://github.com/prisma/prisma-engines/issues/608)
- [Make dmmf dm errors more beautiful](https://github.com/prisma/prisma-engines/issues/607)
- [Schema validation errors broken since alpha 940](https://github.com/prisma/prisma-engines/issues/605)
- [Citext](https://github.com/prisma/prisma-engines/issues/603)
- [The dmmf cli cmd should not crash for env vars](https://github.com/prisma/prisma-engines/issues/602)
- [Test and fix postgres default handling](https://github.com/prisma/prisma-engines/issues/600)
- [Remove the camelcasing for backrelation fields](https://github.com/prisma/prisma-engines/issues/599)
- [Set all datamodel-related flags in structopt](https://github.com/prisma/prisma-engines/issues/598)
- [Add an introspect subcommand to test-cli](https://github.com/prisma/prisma-engines/issues/597)
- [Test mysql defaults](https://github.com/prisma/prisma-engines/issues/596)
- [Adjust legacy M:N Relation Inference](https://github.com/prisma/prisma-engines/issues/595)
- [Test all identifier types on mysql](https://github.com/prisma/prisma-engines/issues/593)
- [Disable playground by default, flag for enabling](https://github.com/prisma/prisma-engines/issues/591)
- [Test postgres exotic filters](https://github.com/prisma/prisma-engines/issues/590)
- [Discriminate between unsupported types and those that cast to string](https://github.com/prisma/prisma-engines/issues/589)
- [Comment out Unsupported Datatypes](https://github.com/prisma/prisma-engines/issues/588)
- [Avoid unecessary allocation in quaint query building](https://github.com/prisma/prisma-engines/issues/587)
- [Recognize all Prisma 1.0 relations as Implicit Many2Many relations](https://github.com/prisma/prisma-engines/issues/586)
- [Postgres exotic filters](https://github.com/prisma/prisma-engines/issues/585)
- [Do not `SELECT 1` before every query](https://github.com/prisma/prisma-engines/issues/582)
- [Test new supported column types](https://github.com/prisma/prisma-engines/issues/581)
- [Adapt ME tests to new defaults handling](https://github.com/prisma/prisma-engines/issues/580)
- [QE: Batch huge `IN` queries into smaller batches](https://github.com/prisma/prisma-engines/issues/579)
- [Remove logic for dropping relations when they are part of the ID](https://github.com/prisma/prisma-engines/issues/578)
- [Batch big IN/NOT IN selections](https://github.com/prisma/prisma-engines/issues/575)
- [fix(errors): move some errors back in spec](https://github.com/prisma/prisma-engines/issues/571)
- [QE: Optimize the compound id select](https://github.com/prisma/prisma-engines/issues/570)
- [[WIP] Introduce `dbGenerated()` for Default values](https://github.com/prisma/prisma-engines/issues/555)
- [Extend Benchmarking Suite](https://github.com/prisma/prisma-engines/issues/548)
- [Query Engine: SQL connector must use chunking when a large number of prisma-engines is reached](https://github.com/prisma/prisma-engines/issues/546)
- [Reduce cloning in nested read](https://github.com/prisma/prisma-engines/issues/539)
- [Make implicit relation rules explicit with prisma-fmt](https://github.com/prisma/prisma-engines/issues/433)


`migrate`

- [prisma2 migrate causes SIGSEGV segfault](https://github.com/prisma/prisma2/issues/migrate/364)

2.0.0preview024

Today, we are issuing the twenty-fourth [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview024` (short: `preview024`).

Major improvements

Reduced size of Prisma Client & Azure functions support

This release contains major improvements for Prisma Client. It now [supports Windows Azure functions](https://github.com/prisma/prisma2/issues/1518). In addition to that, the generated Prisma Client code inside your `node_modules` directory [now is a lot smaller](https://github.com/prisma/prisma-client-js/issues/524).

Another improvement is a better [debugging](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#debugging) experience. When setting the `DEBUG` environment variable (e.g. with `export DEBUG="*"`), the [logging output now contains the names of Prisma Client API calls](https://github.com/prisma/prisma-client-js/issues/551).

Use relation fields as ID on a Prisma model

In this release, it's now possible to use relation fields of Prisma models as IDs. In "database-speak", this means that you can now have both a primary key _and_ a foreign key constraint on the same column.

Reference a single-field ID

For example, a `Movie` could always be identified by its `Director`:

prisma
model Movie {
director Director id
title String
}

model Director {
id Int id default(autoincrement())
name String
}


This is what the corresponding SQL (in SQLite dialect) looks like:

sql
CREATE TABLE "Movie" (
"director" INTEGER NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("director"),
FOREIGN KEY ("director") REFERENCES "Director"("id")
);

CREATE TABLE "Director" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL DEFAULT ''
);


<details><summary>Expand to view an example for creating `Movie`s and `Director`s in Prisma Client</summary>

Nested write to create `Movie` with `Director`:

ts
// Run inside `async` function
const movie = await prisma.movie.create({
data: {
title: "Hello World",
director: {
create: {
name: "Alice"
}
}
},
})


Nested write to create `Director` with `Movie`:

ts
// Run inside `async` function
const director = await prisma.director.create({
data: {
name: "Bob",
movies: {
create: [{
title: "Hello World"
}]
}
},
})



</details>

Reference a multi-field ID

You can also create a relation to a multi-field ID:

prisma
model Movie {
director Director id map(["firstName", "lastName"])
title String
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}


Note that in this case, the `Movie` table in the underlying database will actually have two physical columns called `firstName` and `lastName`. These are referencing the respective `firstName` and `lastName` column on the `Director` table.

Here is what the above models correspond to in SQL:

sql
CREATE TABLE "Movie" (
"firstName" TEXT NOT NULL ,
"lastName" TEXT NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("firstName","lastName"),
FOREIGN KEY ("firstName","lastName") REFERENCES "Director"("firstName","lastName")
);

CREATE TABLE "Director" (
"firstName" TEXT NOT NULL DEFAULT '' ,
"lastName" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("firstName","lastName")
);


In many cases, it might make sense to name the columns on `Movie` differently. For example, they could be called `directorFirstName` and `directorLastName`. This can be achieved via adding the `map` attribute to the field:

prisma
model Movie {
director Director id map(["directorFirstName", "directorLastName"]) relation(references: [firstName, lastName])
title String
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}


Note that in this case you could also omit the `relation` attribute, the result would be the same:

prisma
model Movie {
director Director id map(["directorFirstName", "directorLastName"])
title String
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}


In this case, the field names in `map` on `Movie` get matched with the field names in `id` on `Director`.

Both cases correspond to the following SQL:

sql
CREATE TABLE "Movie" (
"directorFirstName" TEXT NOT NULL ,
"directorLastName" TEXT NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("directorFirstName","directorLastName"),
FOREIGN KEY ("directorFirstName","directorLastName") REFERENCES "Director"("firstName","lastName")
);

CREATE TABLE "Director" (
"firstName" TEXT NOT NULL DEFAULT '' ,
"lastName" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("firstName","lastName")
);



<details><summary>Expand to view an example for creating `Movie`s and `Director`s in Prisma Client</summary>

Nested write to create `Movie` with `Director`:

ts
// Run inside `async` function
const movie = await prisma.movie.create({
data: {
title: 'Hello World',
director: {
create: {
firstName: 'Alice',
lastName: 'Allen',
},
},
},
})


Nested write to create `Director` with `Movie`:

ts
// Run inside `async` function
const director = await prisma.director.create({
data: {
firstName: 'Bob',
lastName: 'Nolan',
movies: {
create: [
{
title: 'Hello World',
},
],
},
},
})


</details>

Multi-field ID with a relation field (which targets a model with a single-field ID)

You can also create a multi-field ID on a model that contains a relation field:

prisma
model Movie {
director Director
title String

id([director, title])
}

model Director {
id String id default(cuid())
name String
}


This corresponds to the following SQL:

sql
CREATE TABLE "Movie" (
"director" TEXT NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("director","title"),
FOREIGN KEY ("director") REFERENCES "Director"("id")
);

CREATE TABLE "Director" (
"id" TEXT NOT NULL ,
"name" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("id")
);



<details><summary>Expand to view an example for creating `Movie`s and `Director`s in Prisma Client</summary>

Nested write to create `Movie` with `Director`:

ts
// Run inside `async` function
const movie = await prisma.movie.create({
data: {
title: 'Hello World',
director: {
create: {
name: 'Alice',
},
},
},
})


Nested write to create `Director` with `Movie`:

ts
// Run inside `async` function
const director = await prisma.director.create({
data: {
name: 'Bob',
movies: {
create: [
{
title: 'Hello World 2',
},
],
},
},
})


</details>

Multi-field ID with a relation field (which targets a model with a multi-field ID)

You can also define a multi-field ID on a model which contains a relation field that targets a model with a multi-field ID:

prisma
model Movie {
director Director
title String

id([director, title])
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}



This is what the above code translates to in SQL:

sql
CREATE TABLE "Movie" (
"director_firstName" TEXT NOT NULL ,
"director_lastName" TEXT NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("director_firstName","director_lastName","title"),
FOREIGN KEY ("director_firstName","director_lastName") REFERENCES "Director"("firstName","lastName")
);

CREATE TABLE "Director" (
"firstName" TEXT NOT NULL DEFAULT '' ,
"lastName" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("firstName","lastName")
);


Similar to the case before, you can also give names to the added columns on `Movie` by using the `map` attributed:

prisma
model Movie {
director Director map(["directorFirstName", "directorLastName"]) relation(references: [firstName, lastName])
title String

id([director, title])
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}


And as before you can also omit the `relation` attribute in this scenario:

prisma
model Movie {
director Director map(["directorFirstName", "directorLastName"])
title String

id([director, title])
}

model Director {
firstName String
lastName String

id([firstName, lastName])
}



In both cases, the models correspond to the following tables:

sql
CREATE TABLE "Movie" (
"directorFirstName" TEXT NOT NULL ,
"directorLastName" TEXT NOT NULL ,
"title" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("directorFirstName","directorLastName","title"),
FOREIGN KEY ("directorFirstName","directorLastName") REFERENCES "Director"("firstName","lastName")
);

CREATE TABLE "Director" (
"firstName" TEXT NOT NULL DEFAULT '' ,
"lastName" TEXT NOT NULL DEFAULT '' ,
PRIMARY KEY ("firstName","lastName")
);


<details><summary>Expand to view an example for creating `Movie`s and `Director`s in Prisma Client</summary>

Nested write to create `Movie` with `Director`:

ts
// Run inside `async` function
const movie = await prisma.movie.create({
data: {
title: 'Hello World',
director: {
create: {
firstName: 'Alice',
lastName: 'Allen',
},
},
},
})


Nested write to create `Director` with `Movie`:

ts
// Run inside `async` function
const director = await prisma.director.create({
data: {
firstName: 'Bob',
lastName: 'Nolan',
movies: {
create: [
{
title: 'Hello World',
},
],
},
},
})


</details>

Breaking changes

`MODELGetSelectPayload` and `MODELGetIncludePayload` have been merged into `MODELGetPayload`. More info [here](https://github.com/prisma/prisma-client-js/issues/564).

Fixes and improvements per Prisma 2 repository

`prisma2`

- [fix(1728) Handle disconnected error for introspection engine](https://github.com/prisma/prisma2/issues/1808)
- [Better handling of introspect crash](https://github.com/prisma/prisma2/issues/1728)
- [[Introspection] Remove type annotation from Postgres default in cases other than Text](https://github.com/prisma/prisma2/issues/1704)
- [Integration tests: SQLite](https://github.com/prisma/prisma2/issues/1603)
- [Integration tests: MySQL](https://github.com/prisma/prisma2/issues/1602)
- [Introspection composite foreign keys pointing to composite primary keys](https://github.com/prisma/prisma2/issues/1599)
- [Prisma doesn't work on Azure windows functions](https://github.com/prisma/prisma2/issues/1518)
- [[Introspection] Postgres `default` include type information](https://github.com/prisma/prisma2/issues/1810)
- [Invalid response data: the query result was required, but an empty Object((Weak)) was returned instead (drupal)](https://github.com/prisma/prisma2/issues/1779)
- [Introspection bug for unique name on MySQL](https://github.com/prisma/prisma2/issues/1774)
- [Integration tests for SQLite and MySQL](https://github.com/prisma/prisma2/issues/1769)
- [Put `prisma/sdk` version in lockstep with `prisma2`](https://github.com/prisma/prisma2/issues/1767)
- [`introspect` for SQLite returns `id` as `String` when it should be `Int`](https://github.com/prisma/prisma2/issues/1764)
- [Update docs about PostgreSQL socket](https://github.com/prisma/prisma2/issues/1756)
- [Document logging options (via `DEBUG` env var)](https://github.com/prisma/prisma2/issues/1697)
- [Kebab-case parameters due to a change in QE/IE/ME](https://github.com/prisma/prisma2/issues/1759)

`migrate`

- [Kebab-case-parameters in ME](https://github.com/prisma/migrate/issues/362)

`prisma-client-js`

- [Reduce size of generated client](https://github.com/prisma/prisma-client-js/issues/524)
- [Print query parameters](https://github.com/prisma/prisma-client-js/issues/504)
- [Nested create broken in latest alpha](https://github.com/prisma/prisma-client-js/issues/480)
- [Query engine generates wrong SQL queries for Hierarchical Data](https://github.com/prisma/prisma-client-js/issues/399)
- [Log all Prisma Client method executions](https://github.com/prisma/prisma-client-js/issues/551)
- [Switching to kebab-case on QE/ME/IE params](https://github.com/prisma/prisma-client-js/issues/542)
- [Change docs about PostgreSQL socket connection](https://github.com/prisma/prisma-client-js/issues/541)

`prisma-engines`

- [Comment out fields with empty names](https://github.com/prisma/prisma-engines/issues/552)
- [Allow Default Values for Enums that look like Booleans](https://github.com/prisma/prisma-engines/issues/551)
- [Postgres Default Values](https://github.com/prisma/prisma-engines/issues/550)
- [Test and fix mapping of mysql and postgres native types](https://github.com/prisma/prisma-engines/issues/538)
- [Start Adding Test Cases for Using a Relation or Parts of it as Primary Key](https://github.com/prisma/prisma-engines/issues/537)
- [Fix prisma-engines567](https://github.com/prisma/prisma-engines/issues/576)
- [Fix unique on composite relation fields](https://github.com/prisma/prisma-engines/issues/573)
- [Better way to query with many compound ids](https://github.com/prisma/prisma-engines/issues/569)
- [ME: Indices to composite foreign keys are impossible to create](https://github.com/prisma/prisma-engines/issues/567)
- [Update README with proper `cargo test` command](https://github.com/prisma/prisma-engines/issues/565)
- [Return a more intelligible error on unexpectedly empty response](https://github.com/prisma/prisma-engines/issues/564)
- [improve nested pagination from O(n log n) to O(n)](https://github.com/prisma/prisma-engines/issues/563)
- [optimize m2m join with in clause](https://github.com/prisma/prisma-engines/issues/562)
- [Index join tables on the B side](https://github.com/prisma/prisma-engines/issues/561)
- [Make foreign key fields cascade on delete by default](https://github.com/prisma/prisma-engines/issues/560)
- [Test and fix Id as part of relation in migration engine](https://github.com/prisma/prisma-engines/issues/559)
- [ME: Many-to-many table indices sub-optimal](https://github.com/prisma/prisma-engines/issues/554)
- [Recognize `int` as Integer on Sqlite](https://github.com/prisma/prisma-engines/issues/553)
- [Unify cli input parsing](https://github.com/prisma/prisma-engines/issues/549)
- [Remove From DMMF](https://github.com/prisma/prisma-engines/issues/547)

2.0.0preview023

Today, we are issuing the twenty-third [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview023` (short: `preview023`).

This release contains breaking changes, be sure to [read the notes below](breaking-changes) before upgrading!

Breaking changes

Cursor-pagination API changed in Prisma Client

Because Prisma now supports composite unique constraints, the `before` and `after` API for cursor-pagination (which is based on unique fields) also changes. The cursor is now wrapped in an object which might have multiple fields.

Assume you have this Prisma model:

prisma
model Post {
id Int default(autoincrement())
title String unique
content String?
}



**Before**

ts
const cursor = 42
const posts = await prisma.post.findMany({
after: cursor
})


**After**

ts
const cursor = 42
const posts = await prisma.post.findMany({
after: { id: cursor }
})


Removed the `enabled` property in `datasource` blocks

The `enabled` property was removed from the `datasource` blocks.

Major improvements

In this issue, we're lifting a major limitation of Prisma which always required every model to have _exactly_ one primary key constraint. In the Prisma schema, this primary key was represented using the `id` attribute.

With this release, you can now have tables:

- without primary keys (but unique constraints)
- with composite primary keys
- with composite unique constraints

Read below for more information on each of these new features. Lifting these limitations was a major effort, please be sure to [report any bugs or other issues](https://github.com/prisma/prisma2/issues/new) you encounter using these new features!

Allows models without IDs

In previous Prisma versions, there was a hard requirement that every model in your Prisma schema needed to have a single `id` field (which maps to a _primary key constraint_ in the underlying database). This requirement is now lifted and your models don't need primary key constraints any more to be compatible with Prisma 2 (they do need at least one unique constraint though).

For example, this data model is now valid:

prisma
model Post {
title String unique
content String?
published Boolean default(false)
author User?
}

model User {
email String unique
name String?
posts Post[]
}


Composite primary keys

As of this release, Prisma supports composite IDs (which map to multi-column primary key constraints in the underlying database). Composite IDs are defined on a "model-level" using the `id` attribute. Here's an example:

prisma
model User {
firstName String
lastName String
email String

id([firstName, lastName])
}


This also impacts the Prisma Client API and how you're querying for single records, e.g. in `findOne`, `update` or `delete` queries where you need to identify a record by its primary key (or another unique field). These queries take the following type as input:

ts
export type UserWhereUniqueInput = {
firstName_lastName?: FirstNameLastNameCompoundUniqueInput | null
}

export type FirstNameLastNameCompoundUniqueInput = {
firstName: string
lastName: string
}


This means, in order to query for a `User` record, you need to provide both `firstName` and `lastName` fields wrapped inside a `firstName_lastName` object:

ts
const user = await prisma.user.findOne({
where: {
firstName_lastName: {
firstName: "Jane",
lastName: "Doe"
}
}
})


Composite unique indexes / constraints

As of this release, Prisma also supports composite unique constraints (which map to multi-column unique constraints in the underlying database). Composite unique constraints are defined on a "model-level" using the `unique` attribute.

> **Note**: Primary key and unique constraints are very similar but have some differences on the database-level. You can learn more about the differences [here](https://www.geeksforgeeks.org/difference-between-primary-key-and-unique-key/).

Here's an example:

prisma
model User {
firstName String
lastName String
email String

unique([firstName, lastName])
}


This also impacts the Prisma Client API and how you're querying for single records, e.g. in `findOne`, `update` or `delete` queries where you need to identify a record by its primary key (or another unique field). These queries take the following type as input:

ts
export type UserWhereUniqueInput = {
firstName_lastName?: FirstNameLastNameCompoundUniqueInput | null
}

export type FirstNameLastNameCompoundUniqueInput = {
firstName: string
lastName: string
}


This means, in order to query for a `User` record, you need to provide both `firstName` and `lastName` fields wrapped inside a `firstName_lastName` object:

ts
const user = await prisma.user.findOne({
where: {
firstName_lastName: {
firstName: "Jane",
lastName: "Doe"
}
}
})


Introspection now recognizes default constraints

Prisma's introspection now reconized [`DEFAULT`](https://www.w3schools.com/sql/sql_default.asp) constraints that are defined on a column. These constraints are represented in the generated Prisma schema using the `default` attribute.

Optimize nested GraphQL queries that use Prisma Client ("dataloader")

When building a GraphQL server with Prisma Client, it wasn't easy to avoid the n+1 problem with nested queries. This release of Prisma Client optimizes the execution of GraphQL nested queries by batching requests against the database.

Fixes and improvements per Prisma 2 repository

`prisma2`

- [Add prisma/studio-types to prisma2 devDependencies](https://github.com/prisma/prisma2/issues/1714)
- [`generate --watch` broken](https://github.com/prisma/prisma2/issues/1706)
- [Error: [/rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/macros/mod.rs:15:40] called `Option::unwrap()` on a `None` value](https://github.com/prisma/1692/prisma2/issues)
- [Add docs for `.raw` template literal API with parameters 1583](https://github.com/prisma/prisma2/issues/1688)
- [Unclear rust error: called `Option::unwrap()` on a `None` value](https://github.com/prisma/prisma2/issues/1677)
- [[Introspection] Order of fields in index changes with alpha 808 for PostgreSQL](https://github.com/prisma/prisma2/issues/1666)
- [add error formatting docs](https://github.com/prisma/prisma2/issues/1654)
- [add docs for utility types](https://github.com/prisma/prisma2/issues/1653)
- [remove mentions of mongodb](https://github.com/prisma/prisma2/issues/1647)
- [Remove MongoDB from documentation](https://github.com/prisma/prisma2/issues/1646)
- [Document SQLite connection strings](https://github.com/prisma/prisma2/issues/1645)
- [`Error: P4001 The introspected database was empty: undefined` url or file if sqlite should be displayed instead of undefined](https://github.com/prisma/1633/prisma2/issues)
- [Clean up branches](https://github.com/prisma/prisma2/issues/1631)
- [Document MySQL unix socket connection usage](https://github.com/prisma/prisma2/issues/1629)
- [Error: Schema parsing thread 'main' panicked at 'assertion failed: `(left == right)`](https://github.com/prisma/prisma2/issues/1624)
- [[Introspection] "Error: Schema parsing thread 'main' panicked at 'Encountered impossible datamodel declaration during parsing: "](https://github.com/prisma/1623/prisma2/issues)
- [[Introspection] Postgres serial type is missing default(autoincrement())](https://github.com/prisma/prisma2/issues/1596)
- [Document workarounds for No-identifier-tables](https://github.com/prisma/prisma2/issues/1588)
- [Improve `.raw` template literal API with parameters](https://github.com/prisma/prisma2/issues/1583)
- [Document error formatting](https://github.com/prisma/prisma2/issues/1570)
- [--experimental flag order](https://github.com/prisma/prisma2/issues/1568)
- [`generate` shows "Downloading ..." every time when a custom binaryTarget is specified](https://github.com/prisma/prisma2/issues/1560)
- [[Introspection] Investigate field/model types](https://github.com/prisma/prisma2/issues/1542)
- [Remove enabled field from datasource block](https://github.com/prisma/prisma2/issues/1512)
- [Query Engine failed ENOENT](https://github.com/prisma/prisma2/issues/1427)
- [Certificate identity files are required in both prisma folder and in the folder from which lift is executed](https://github.com/prisma/prisma2/issues/1286)
- [Do not require environment variables for `generate`](https://github.com/prisma/prisma2/issues/800)
- [Prisma is not including columns of Postgres type 'time without time zone' in schema](https://github.com/prisma/prisma2/issues/487)

`prisma-client-js`

- [Improve reserved words / denylist for code generation](https://github.com/prisma/prisma-client-js/issues/528)
- [Implement new private fields for PrismaClient](https://github.com/prisma/prisma-client-js/issues/526)
- [Lowercasing of model and field names](https://github.com/prisma/prisma-client-js/issues/525)
- [`.raw` template literal API with parameters](https://github.com/prisma/prisma-client-js/issues/522)
- [`JSON.parse(dmmfString)` fails on prisma schema with docs](https://github.com/prisma/prisma-client-js/issues/516)
- [Fix Error's meta property typing](https://github.com/prisma/prisma-client-js/issues/515)
- [improve download logic](https://github.com/prisma/prisma-client-js/issues/506)
- [Test Prisma Client with pgBouncer](https://github.com/prisma/prisma-client-js/issues/500)
- ["Note, that by providing `native`, Prisma Client automatically resolves `rhel-openssl-1.0.x`"](https://github.com/prisma/prisma-client-js/issues/475)
- [Better runtime error handling for missing binaries](https://github.com/prisma/prisma-client-js/issues/466)
- [Document utility types](https://github.com/prisma/prisma-client-js/issues/463)
- [File name (`datamodel.mdl`) and client name (`Photon JS`) in graphic in README need to be updated](https://github.com/prisma/prisma-client-js/issues/447)
- [Hide top-level client properties (as they are visible via JS code intellisense)](https://github.com/prisma/prisma-client-js/issues/421)
- [tslint: Invalid 'await' of a non-Promise value](https://github.com/prisma/prisma-client-js/issues/157)

`prisma-engines`

- [[Query Core] Housekeeping](https://github.com/prisma/prisma-engines/issues/544)
- [DMMF: add information about multi field uniques](https://github.com/prisma/prisma-engines/issues/542)
- [do not fail on missing env vars in dmmf](https://github.com/prisma/prisma-engines/issues/541)
- [Only build relevant binaries in connector-test-kit](https://github.com/prisma/prisma-engines/issues/540)
- [Return a known error on invalid/absent database string](https://github.com/prisma/prisma-engines/issues/536)
- [Fix crash on building of foreign keys overlapping with PK](https://github.com/prisma/prisma-engines/issues/535)
- [Panic for empty env var](https://github.com/prisma/prisma-engines/issues/533)
- [Implementing execute raw tests in rust](https://github.com/prisma/prisma-engines/issues/532)
- [Temporarily Drop Relations on Compound Ids](https://github.com/prisma/prisma-engines/issues/531)
- [Test explicit enum default migrations with map](https://github.com/prisma/prisma-engines/issues/529)
- [Any Relation References](https://github.com/prisma/prisma-engines/issues/528)
- [Remove lazy-static](https://github.com/prisma/prisma-engines/issues/526)
- [Fix postgres field ordering inside indexes in sql schema describer](https://github.com/prisma/prisma-engines/issues/525)
- [Test index fields ordering is preserved in postgres sql-schema-describer](https://github.com/prisma/prisma-engines/issues/524)
- [Take `map` into account when migrating enum values](https://github.com/prisma/prisma-engines/issues/522)
- [Implement diffing of enum value directives](https://github.com/prisma/prisma-engines/issues/520)
- [Introspect Serial as Autoincrement on Postgres](https://github.com/prisma/prisma-engines/issues/518)
- [Optimize the amount of queries sent by sql-schema-describer on postgres](https://github.com/prisma/prisma-engines/issues/517)
- [Propagate quaint timeout messages to introspection connector errors](https://github.com/prisma/prisma-engines/issues/516)
- [Optimized Postgres Introspection](https://github.com/prisma/prisma-engines/issues/515)
- [Add rule for doc-comments to data model Parser](https://github.com/prisma/prisma-engines/issues/514)
- [Find one optimization](https://github.com/prisma/prisma-engines/issues/513)
- [Do not add map to virtual back relation fields](https://github.com/prisma/prisma-engines/issues/512)
- [Remap Invalid Enum Values](https://github.com/prisma/prisma-engines/issues/508)
- [Single-field unique is not handled correctly.](https://github.com/prisma/prisma-engines/issues/506)
- [EPIC: relation(references: ..) for multiple fields](https://github.com/prisma/prisma-engines/issues/301)
- [Query Engine: Loosen id requirement. At least one unique criteria is enough.](https://github.com/prisma/prisma-engines/issues/296)
- [EPIC: Loosen id requirement. At least one unique criteria is enough.](https://github.com/prisma/prisma-engines/issues/292)

2.0.0preview022

Today, we are issuing the twenty-second [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview022` (short: `preview022`).

This release contains breaking changes, be sure to [read the notes below](breaking-changes) before upgrading!

Major improvements

- Send raw SQL queries using `prisma.raw(sql)` (read the [API docs](https://github.com/prisma/prisma2/blob/master/docs/prisma-client-js/api.md#raw-database-access))
- Stopped shipping TypeScript with Prisma Client JS
- Various introspection improvements
- `prisma2 init` now uses environment variables and creates a [`.env`](https://github.com/motdotla/dotenv) file

Breaking changes

Remove pluralization of virtual back-relation fields

The following change is only breaking if you're using introspection _and_ are currently using Prisma Client API calls that are referencing a virtual back-relation field. Read on to learn more.

When introspecting a table with a foreign key, Prisma automatically creates a "virtual back-relation" field on the respective Prisma model. Consider the following SQL schema:

sql
CREATE TABLE User (
user_id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(256),
);

CREATE TABLE Post (
post_id SERIAL PRIMARY KEY NOT NULL,
title VARCHAR(256) NOT NULL,
author_id INTEGER,
FOREIGN KEY (author_id) REFERENCES User(user_id)
);


In previous Prisma 2 preview versions, the resulting Prisma data model after introspection used to be:

prisma
model User {
user_id Int id default(autoincrement())
posts Post[] // before `preview022`
}

model Post {
post_id Int id default(autoincrement())
title String
author User?
}


Notice the `posts` field which has been added by Prisma. This field does not exist as a column on the database-level, but is a "virtual back-relation" field in the Prisma schema.

With `preview022`, the pluralization of the virtual back-relation field has been removed. The new introspection result would be:

prisma
model User {
user_id Int id default(autoincrement())
post Post[] // after `preview022`
}

model Post {
post_id Int id default(autoincrement())
title String
author User?
}


Path for default `.env` file changed
As explained in [this issue](https://github.com/prisma/prisma2/issues/1519), the path to the default `.env` file is changed in this Preview version. Before, the Prisma CLI automatically loaded the environment variables from a `.env` file in the **current working directory**. This now changes and it _only_ loads them from **the directory that contains the `schema.prisma` file**.

Enums are now handled natively (Prisma Migrate)

Enums in the Prisma schema are now mapped to enums in the underlying database (previously they were represented as strings). This means enum support for SQLite is completely removed since SQLite doesn't support enums.

Fixes and improvements per Prisma 2 repository

`prisma2`

- [Implement changes from CLI spec](https://github.com/prisma/prisma2/issues/1618)
- [Environment variable not found on latest alpha release](https://github.com/prisma/prisma2/issues/1613)
- [`warning In order to use "prisma/client", please install prisma2. You can install it with "npm add -D prisma2"` is printed even when prisma2 is installed](https://github.com/prisma/prisma2/issues/1610)
- [Fetch binaries from domain instead of direct s3 url](https://github.com/prisma/prisma2/issues/1593)
- [Implement new init flow spec](https://github.com/prisma/prisma2/issues/1584)
- [[Introspection] Change work distribution between CLI and Introspection Engine](https://github.com/prisma/prisma2/issues/1576)
- [Document `.raw` API](https://github.com/prisma/prisma2/issues/1552)
- [Download prints many empty lines](https://github.com/prisma/prisma2/issues/1551)
- [Improve DX about --experimental CLI commands](https://github.com/prisma/prisma2/issues/1547)
- [Use anonymous machine token from checkpoint for error reporting](https://github.com/prisma/prisma2/issues/1544)
- [`prisma/clientx is not compatible with prisma2y. Their versions need to be equal.`, generates anyway](https://github.com/prisma/prisma2/issues/1539)
- [Introspection: Don't execute `getDatabaseDescription` if error consent screen didn't have confirmation](https://github.com/prisma/prisma2/issues/1530)
- [Only support `.env` file next to `schema.prisma`](https://github.com/prisma/prisma2/issues/1519)
- [[Introspection] No ID: Why does it sometimes error and sometimes panic?](https://github.com/prisma/prisma2/issues/1515)
- [[Introspection] `id` refers to original field name instead of `map`-ped one](https://github.com/prisma/prisma2/issues/1503)
- [Introspection Error Reporting does not output report ID](https://github.com/prisma/prisma2/issues/1501)
- [`introspect`: "Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed"](https://github.com/prisma/prisma2/issues/1500)
- [MySQL datamodel not matching prisma2 introspect generated schema](https://github.com/prisma/prisma2/issues/1497)
- [`generate`: "Error: Schema parsing --- thread 'main' has overflowed its stack"](https://github.com/prisma/prisma2/issues/1496)
- [Native Enums only](https://github.com/prisma/prisma2/issues/1495)
- [[Introspection] Investigate and improve introspection speed](https://github.com/prisma/prisma2/issues/1494)
- [Improve error when `id` is a String in the schema but an Integer in SQLite.](https://github.com/prisma/prisma2/issues/1490)
- [Make using DATABASE_URL as default DB connection URL a best practice](https://github.com/prisma/prisma2/issues/1481)
- [Init flow should default to using environment variables for connection URLs](https://github.com/prisma/prisma2/issues/1480)
- [Create "Getting started" escape hatch for non-existent databases](https://github.com/prisma/prisma2/issues/1479)
- [Change default schema.prisma](https://github.com/prisma/prisma2/issues/1478)
- [Migration guide missing from Getting Started](https://github.com/prisma/prisma2/issues/1476)
- [Improve SSL connection docs](https://github.com/prisma/prisma2/issues/1463)
- [Empty Introspection result could lead to much nicer error message and explanation](https://github.com/prisma/prisma2/issues/1462)
- [Supply a custom path to Prisma schema file for CLI commands (i.e. `--schema`?)](https://github.com/prisma/prisma2/issues/1412)
- [Improve `introspect` command, backup behavior](https://github.com/prisma/prisma2/issues/1369)
- [Unclear Introspection error message: Error parsing attribute "id": Fields that are marked as id must be required.](https://github.com/prisma/prisma2/issues/1368)
- [[Introspection] Additionally output count of error at end of validation output](https://github.com/prisma/prisma2/issues/1151)
- [[Introspection] Better handling of "Error: Empty introspection result for ..."](https://github.com/prisma/prisma2/issues/1145)
- [[Introspection] "error: Field 'x' is already defined on model 'y'.", relation name clashes](https://github.com/prisma/prisma2/issues/1103)
- [[Introspection] "No id field defined!" should not panic and crash, but just output an error](https://github.com/prisma/prisma2/issues/1077)
- [[Introspection] posts are turned into postses](https://github.com/prisma/prisma2/issues/1109)
- [[Introspection] Panic "No id field defined!" (caused by: no id at all)](https://github.com/prisma/prisma2/issues/1113)
- [Inconsistent engine files names](https://github.com/prisma/prisma2/issues/1049)
- [Introspection tells me `⠋ Introspecting MySQL schema with 1 tables.` during introspection](https://github.com/prisma/prisma2/issues/794)
- [`Upsert` causes random self-referencing 1:1 relations to break](https://github.com/prisma/prisma2/issues/622)

`prisma-client-js`

- [SQLite: Tokio stack overflow for a lot of data](https://github.com/prisma/prisma-client-js/issues/481)
- [Remove compatibility plural api](https://github.com/prisma/prisma-client-js/issues/479)
- [Unclear error when we guess a binary](https://github.com/prisma/prisma-client-js/issues/478)
- [Execute raw is failing when template literal span over multiple lines.](https://github.com/prisma/prisma-client-js/issues/473)
- [Cannot read property 'plural' of undefined at PrismaClientClass.get jsDoc](https://github.com/prisma/prisma-client-js/issues/472)
- [Implement `nextTick` - based batching](https://github.com/prisma/prisma-client-js/issues/471)
- [Postinstall: `undefined` and Error](https://github.com/prisma/prisma-client-js/issues/467)
- [`generate` tells me to install wrong Prisma Client package](https://github.com/prisma/prisma-client-js/issues/1537)
- [Add JSDoc to top-level argument types](https://github.com/prisma/prisma-client-js/issues/457)
- [.raw(...) query](https://github.com/prisma/prisma-client-js/issues/455)
- [Prisma Client should pick up required env vars from .env file during development](https://github.com/prisma/prisma-client-js/issues/454)
- [Make "unnecessary" client properties private](https://github.com/prisma/prisma-client-js/issues/450)
- [Database restart not handled gracefully](https://github.com/prisma/prisma-client-js/issues/446)
- [AWS LAMBDA - Invalid photon.() EROFS: read-only file system, chmod '/var/task/.../query-engine-rhel-openssl-1.0.x'](https://github.com/prisma/prisma-client-js/issues/445)
- [Duplicate `null` in ENUM filters](https://github.com/prisma/prisma-client-js/issues/442)
- [Stub types should be included in the released package](https://github.com/prisma/prisma-client-js/issues/438)
- [UUID joins not working after 0.20 upgrade](https://github.com/prisma/prisma-client-js/issues/434)
- [Document Timeouts in Prisma Client for high parallel usage](https://github.com/prisma/prisma-client-js/issues/433)
- [Do not mutate exports.dmmf in generated Prisma Client](https://github.com/prisma/prisma-client-js/issues/420)
- [Stop shipping TypeScript](https://github.com/prisma/prisma-client-js/issues/391)
- [Expose a utility TS type to be able to extract the return type for model expressions with includes](https://github.com/prisma/prisma-client-js/issues/374)
- [Bad enum naming cause Prisma Client generation error in index.d.ts](https://github.com/prisma/prisma-client-js/issues/363)
- [Bundlers and binary as static assets](https://github.com/prisma/prisma-client-js/issues/119)

`migrate`

- [Wrong name in error message](https://github.com/prisma/prisma2/issues/333)
- [`--help` does not need `--experimental` for main `migrate`, does for `migrate save`](https://github.com/prisma/migrate/issues/317)

`prisma-engines`

- [Test that tables without primary key can be created](https://github.com/prisma/prisma-engines/issues/505)
- [Rename repository to `prisma-engines`](https://github.com/prisma/prisma-engines/issues/446)
- [UUID ID fields cause serialization to fail](https://github.com/prisma/prisma-engines/issues/441)
- [Support MariaDB in the migration and introspection engines](https://github.com/prisma/prisma-engines/issues/317)

2.0.0preview021

Today, we are issuing the twenty-first [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview021` (short: `preview021`).

This release contains breaking changes, be sure to read the notes [below](breaking-changes) before upgrading!

⚠️ **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.9.0

Breaking changes

The property on the `PrismaClient` that exposes CRUD operations per model used to be lowercased and pluralized, the [**pluralization of that property is now removed**](https://github.com/prisma/prisma-client-js/issues/423).

For example, for a `model User` you'd access a CRUD operation via the generated `prisma.users` property, as in `prisma.users.findMany()`. As of `preview021`, the pluralization has been removed and the property is called after the model (but lowercased), so it would now be `prisma.user.findMany()`.

Here are few more examples showing how the calls to your `PrismaClient` instance must be adjusted:

**Prisma schema**

prisma
model User {
id Int id default(autoincrement())
name String
}


**Generated Prisma Client API**

diff
const prisma = new PrismaClient()

// CRUD operations are exposed via:
- // prisma.users
+ // prisma.user

// findMany
- const users = await prisma.users.findMany()
+ const users = await prisma.user.findMany()

// findOne
- const user = await prisma.users.findOne({ where: { id: 1 }})
+ const user = await prisma.user.findOne({ where: { id: 1 }})

// create
- const user = await prisma.users.create({ data: { name: "Alice" }})
+ const user = await prisma.user.create({ data: { name: "Alice" }})

// and so on ...



Improvements

Besides many small fixes, Prisma Client JS now uses JSDoc to bring API documentation to your fingertips as you write code in your editor:

![image](https://user-images.githubusercontent.com/1094804/73459135-98624380-4376-11ea-90f2-ee36416a2421.png)

Fixes and improvements per Prisma 2 repository

`prisma2`

- [Broken pris.ly links in initial schema](https://github.com/prisma/prisma2/issues/1458)
- [ExperimentalWarning: The fs.promises API is experimental message in CLI](https://github.com/prisma/prisma2/issues/1431)
- [Api naming issue](https://github.com/prisma/prisma2/issues/1425)
- [generate: Error message when there are no models](https://github.com/prisma/prisma2/issues/1420)
- [Error in migration engine - Cannot start a runtime from within a runtime.](https://github.com/prisma/prisma2/issues/1419)
- [Change `generate --help` message to `Generate artifacts (e.g. Prisma Client)`](https://github.com/prisma/prisma2/issues/1417)
- [Adjust Prisma tagline in CLI to `Prisma is a modern DB toolkit to query, migrate and model your database`](https://github.com/prisma/prisma2/issues/1416)
- [Remove `prisma2 migrate docs`](https://github.com/prisma/prisma2/issues/1415)
- [Detect if unicode character can be rendered in CLI output before printing it](https://github.com/prisma/prisma2/issues/1413)
- [`undefined` in `prisma2 init --help` output](https://github.com/prisma/prisma2/issues/1411)
- [Remove documenation about onDelete](https://github.com/prisma/prisma2/issues/1406)
- [Error in migration engine - no current timer when using prisma2 migrate](https://github.com/prisma/prisma2/issues/1395)
- [Introspection Error reporting does not exit on Windows](https://github.com/prisma/prisma2/issues/1367)
- [Improve formatting of missing generator error message](https://github.com/prisma/prisma2/issues/1362)
- [Handle errors in `prisma introspect`](https://github.com/prisma/prisma2/issues/1340)
- [Small docs issue/question createdAt attribute](https://github.com/prisma/prisma2/issues/1332)
- [Supress downloads when custom binary via environment variable is used](https://github.com/prisma/prisma2/issues/1329)
- [Improve error message when OpenSSL is missing](https://github.com/prisma/prisma2/issues/1328)
- [Introspection: autoincrement not recognized on SERIAL field](https://github.com/prisma/prisma2/issues/1326)
- [[Introspection] Different order of ENUMs when introspecting Postgres DB](https://github.com/prisma/prisma2/issues/1303)
- [Add an example with Prisma and Apollo Server in plain GraphQL without Nexus](https://github.com/prisma/prisma2/issues/1281)
- [`prisma2 init` fails in Yarn Workspaces](https://github.com/prisma/prisma2/issues/1199)
- [Prisma2 dev crash : thread 'main' panicked at 'Unable to resolve scalar field'](https://github.com/prisma/prisma2/issues/1352)
- [Error with Prisma v18.2: can't find schema.prisma](https://github.com/prisma/prisma2/issues/1134)
- [Inconsistent type generation for default values](https://github.com/prisma/prisma2/issues/780)
- [Each project using Prisma (and its query engine runtime) gets its own Firewall request](https://github.com/prisma/prisma2/issues/613)

`prisma-client-js`

- [Prisma client dmmf emits enum fields as scalar type](https://github.com/prisma/prisma-client-js/issues/432)
- [Wrong error message when invoking `findOne` without args](https://github.com/prisma/prisma-client-js/issues/431)
- [Remove pluralization](https://github.com/prisma/prisma-client-js/issues/423)
- [Document that you can not do select in include](https://github.com/prisma/prisma-client-js/issues/416)
- [Usage with `pg-bouncer`](https://github.com/prisma/prisma-client-js/issues/410)
- [Photon crashes when `set` for scalarList is not provided or it is set to `[]`](https://github.com/prisma/prisma-client-js/issues/422)
- [Improve connection error message to PostgreSQL database](https://github.com/prisma/prisma-client-js/issues/402)
- [Cannot read property 'collectErrors' of null](https://github.com/prisma/prisma-client-js/issues/369)
- [`postinstall` script of this package fails if using env var in my schema](https://github.com/prisma/prisma-client-js/issues/326)
- [Wrong suggestions for relations](https://github.com/prisma/prisma-client-js/issues/220)
- [Name collision with identical relational property names on separate types that refer to a common type](https://github.com/prisma/prisma-client-js/issues/201)

`migrate`

- [Typo in message after "prisma2 migrate up --experimental" command](https://github.com/prisma/migrate/issues/327)
- [Unexpected error occured when running migrate up in latest alpha.](https://github.com/prisma/migrate/issues/322)
- [CLI: Reorder the help output of migrate to be save, up, down (instead of save, down, up)](https://github.com/prisma/migrate/issues/318)

`prisma-engine`

- [Expose SQLSchema RPC Call for Debugging](https://github.com/prisma/prisma-engine/issues/423)
- [Sql Introspection Connector must handle `default(autoincrement())`](https://github.com/prisma/prisma-engine/issues/393)
- [Introspection Engine: Disable verbose logging](https://github.com/prisma/prisma-engine/issues/382)
- [Implement `map` for relation fields that use compound references](https://github.com/prisma/prisma-engine/issues/352)
- [Error wording: Use "Prisma schema" instead of hardcoded "schema.prisma"](https://github.com/prisma/prisma-engine/issues/315)
- [Error P1006: Say "query engine binary" instead of "Photon binary"](https://github.com/prisma/prisma-engine/issues/314)
- [Error message for SQLite shouldn't mention DB server](https://github.com/prisma/prisma-engine/issues/313)





2.0.0-preview020.3
Fixes
- [Unable to parse response from migration engine 321](https://github.com/prisma/migrate/issues/321)

2.0.0-preview020.2
Fixes
- [Error in migration engine - Cannot start a runtime from within a runtime. 1114](https://github.com/prisma/prisma2/issues/1419)

2.0.0-preview020.1
Fixes
- [Error in migration engine - no current timer when using prisma2 migrate 1395](https://github.com/prisma/prisma2/issues/1395)

2.0.0preview020

Today, we are issuing the twentieth [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview020` (short: `preview020`).

This release has a number of major and breaking changes, be sure to read the notes [below](breaking-changes) 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](https://github.com/prisma/prisma-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`:

diff
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`:

diff
- 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:

diff
- 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`](https://www.github.com/prisma/prisma-client-js). We also removed the former Photon.js website on `https://photonjs.prisma.io` and are redirecting it to these release notes.

<details><summary>Why was Photon.js renamed?</summary>
<br />

We renamed Photon.js in [an effort to make Prisma simpler](https://github.com/prisma/prisma2/issues/1048). 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.

</details>

Lift has been renamed to Prisma Migrate and is now behind an `--experimental` flag

Prisma's `lift` subcommand has been renamed to `migrate`:

diff
- 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`](https://www.github.com/prisma/migrate). We also removed the former Lift website on `https://lift.prisma.io` and are redirecting it to these release notes.

<details><summary>Why was Lift renamed?</summary>
<br />

We renamed Lift in [an effort to make Prisma simpler](https://github.com/prisma/prisma2/issues/1048). 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.

</details>

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



<details><summary>Why was <code>prisma2 dev</code> removed?</summary>
<br />

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`.

</details>

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.
1. Set your DB connection string as the `url` of the `datasource` block inside the Prisma schema.
1. Run `prisma2 introspect` to test the connection and obtain your data model.
1. Run `prisma2 generate` to generate Prisma Client.

You can then start using Prisma Client in your application:

ts
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](https://github.com/prisma/prisma2/blob/master/docs/getting-started.md).

If you want to get started with a new project instead of using an existing database, check out the available [examples](https://github.com/prisma/prisma-examples/).

<details><summary>Why was the interactive <code>prisma2 init</code> wizard removed?</summary>
<br />

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.

</details>

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](https://github.com/prisma/prisma2/blob/master/docs/telemetry.md).

You can opt-out of this behavior by setting the `CHECKPOINT_DISABLE` environment variable to `1`, e.g.:

bash
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`

- [[Introspection] Error: Schema parsing](https://github.com/prisma/prisma2/issues/1067)
- [[Introspection] dot (and other non-[a-z0-9] characters) in field name](https://github.com/prisma/prisma2/issues/1106)
- [ENOENT error when running prisma as /api in next.js](https://github.com/prisma/prisma2/issues/1021)
- [ManyToMany pivot table](https://github.com/prisma/prisma2/issues/1017)
- [Use jszip instead of adm-zip to zip error reports](https://github.com/prisma/prisma2/issues/1000)
- [[Feature Request] Default to public schema when using postgresql](https://github.com/prisma/prisma2/issues/986)
- [Back button does not work on init flow with SQLite selected](https://github.com/prisma/prisma2/issues/819)
- [`init`, Introspection: Tells me that schema is not empty, does not even exist though](https://github.com/prisma/prisma2/issues/777)
- [`init`: Starter Kit flows only show empty databases](https://github.com/prisma/prisma2/issues/775)
- [`init`: Input is not disabled while connecting to database](https://github.com/prisma/prisma2/issues/739)
- [`prisma2 generate` keeps downloading query engine (or at least tells me it does)](https://github.com/prisma/prisma2/issues/725)
- [`init`: Back button is not working](https://github.com/prisma/prisma2/issues/723)
- [Support NO_COLOR env var to strip color from output](https://github.com/prisma/prisma2/issues/686)
- [`prisma2 init`, first step is labeled "Languages for starter kits"](https://github.com/prisma/prisma2/issues/501)
- [`init`: Wrong "Back" detail](https://github.com/prisma/prisma2/issues/499)
- [README should be removed from `Blank project` -> ... -> `Demo script` option](https://github.com/prisma/prisma2/issues/472)
- [Defaults are not being used in the new init flow](https://github.com/prisma/prisma2/issues/471)
- [`prisma2 init` navigation infinite loop](https://github.com/prisma/prisma2/issues/466)
- [Visibility into DB queries generated by Photon](https://github.com/prisma/prisma2/issues/388)
- [Add transactions to contents](https://github.com/prisma/prisma2/issues/1183)
- [`prisma2 generate` tries to install `prisma/photon` even in folder without `package.json`](https://github.com/prisma/prisma2/issues/1147)
- [ENV Variables with SQLite](https://github.com/prisma/prisma2/issues/1142)
- [[Introspection] Support non-alphanumeric characters in model names](https://github.com/prisma/prisma2/issues/1140)
- [[Introspection] Support non-alphanumeric characters in field names](https://github.com/prisma/prisma2/issues/1139)
- [Docs: Prisma schema link leads to a `not found` page](https://github.com/prisma/prisma2/issues/1135)
- [Document index](https://github.com/prisma/prisma2/issues/1131)
- [Report Introspection errors to Error Reporting Backend](https://github.com/prisma/prisma2/issues/1124)
- [Provided database name is ignored in prisma init](https://github.com/prisma/prisma2/issues/1120)
- [Invalid photon provider results in a silent error](https://github.com/prisma/prisma2/issues/1102)
- [Introspection documentation could mention `--url`](https://github.com/prisma/prisma2/issues/1094)
- [[Introspection] `?` is not accepted as character in column name](https://github.com/prisma/prisma2/issues/1082)
- [[Introspection] `(` is not accepted as character in column name](https://github.com/prisma/prisma2/issues/1081)
- [[Introspection] Space is not accepted as character in column name](https://github.com/prisma/prisma2/issues/1080)
- [[Introspection] `-` is not accepted as character in column name](https://github.com/prisma/prisma2/issues/1079)
- [[Introspection] `/` is not accepted as character in column name](https://github.com/prisma/prisma2/issues/1078)
- [[Introspection] Fields and models starting with numbers should be valid](https://github.com/prisma/prisma2/issues/1076)
- [CLI init always reports that dependencies are installed via npm](https://github.com/prisma/prisma2/issues/1191)
- [Add generate --watch to CLI](https://github.com/prisma/prisma2/issues/1356)
- [New, simpler `init`](https://github.com/prisma/prisma2/issues/1349)
- [Remove `dev`](https://github.com/prisma/prisma2/issues/1348)
- [--experimental + lift => migrate](https://github.com/prisma/prisma2/issues/1347)
- [prisma2 generate is trying to download from incorrect url (debiandebian-openssl-1.1.x/prisma.gz)](https://github.com/prisma/prisma2/issues/1301)
- [Docs for working with types](https://github.com/prisma/prisma2/issues/1282)
- [Fixed npm package installation command syntax](https://github.com/prisma/prisma2/issues/1248)
- [CLI tries to download npm packages using `npm add`](https://github.com/prisma/prisma2/issues/1247)
- [Introspection failed with "Please wait until the 'prisma query-engine' download completes! / SyntaxError: Unexpected token P in JSON at position 0"](https://github.com/prisma/prisma2/issues/1232)
- [Listen for `--help` to print help in `prisma2 init`](https://github.com/prisma/prisma2/issues/1195)

`prisma-client-js`

- [Filtering by ENUM type](https://github.com/prisma/photonjs/issues/361)
- [Photon Zeebe bug (prototype pollution?)](https://github.com/prisma/photonjs/issues/296)
- [Adding `new Photon` in the lambda function context stops the engine](https://github.com/prisma/photonjs/issues/274)
- [Allow reconnecting after disconnect](https://github.com/prisma/photonjs/issues/273)
- [Runtime validation error on `orderBy: null` many query](https://github.com/prisma/photonjs/issues/248)
- [Turn off pretty errors](https://github.com/prisma/photonjs/issues/195)
- [Second default(now()) doesn't work](https://github.com/prisma/photonjs/issues/183)
- [Photon and undefined target="exit" error](https://github.com/prisma/photonjs/issues/357)
- [Error when trying to filter multiple fields of a many-to-many relationship within a where clause](https://github.com/prisma/photonjs/issues/356)
- [fix: correct typo](https://github.com/prisma/photonjs/issues/346)
- [Add logging for Photon time vs. Query Engine time](https://github.com/prisma/photonjs/issues/345)
- [Unable to apply 'where' arguments beyond (3rd?) level](https://github.com/prisma/photonjs/issues/322)
- [fix(photon): allow reconnecting after disconnect](https://github.com/prisma/photonjs/issues/392)
- [Photon's query engine process characteristics](https://github.com/prisma/photonjs/issues/389)
- [Add direct link to prisma-examples repo](https://github.com/prisma/photonjs/issues/380)
- [Add README Improvement](https://github.com/prisma/photonjs/issues/379)
- [TSClient: Exposes model select/include utility types](https://github.com/prisma/photonjs/issues/378)
- [Expose the `*GetSelectPayload` and `*GetIncludePayload` utility types](https://github.com/prisma/photonjs/issues/376)
- [Fix typo](https://github.com/prisma/photonjs/issues/371)

`migrate`

- [keep comments intact when masking schema](https://github.com/prisma/lift/issues/235)
- [Lift save/up hangs at creating SQLite db](https://github.com/prisma/lift/issues/219)
- [Fix help messages in CLI](https://github.com/prisma/lift/issues/223)
- [--auto-approve is unknown when lifting down](https://github.com/prisma/lift/issues/254)
- [Remove unused option from Lift Down help](https://github.com/prisma/lift/issues/262)
- [Listen for `--help` argument to print help on `prisma2 dev`](https://github.com/prisma/lift/issues/263)


`prisma-engine`

- [Benchmark Effects of Removing Implicit Ordering by Id](https://github.com/prisma/prisma-engine/issues/226)
- [Extend Destructive Changes: Warn if default is removed from an underlying column](https://github.com/prisma/prisma-engine/issues/182)
- [Investigate created_at getting migrated without intervention](https://github.com/prisma/prisma-engine/issues/287)
- [Change an INFO log to a DEBUG log](https://github.com/prisma/prisma-engine/issues/365)
- [Performance monitoring: return time spent in the engine](https://github.com/prisma/prisma-engine/issues/350)
- [Avoid unnecessary migrations due to ambiguous defaults on optional fields](https://github.com/prisma/prisma-engine/issues/333)

Page 26 of 44

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.