Today, we are issuing the nineteenth [Preview release](https://github.com/prisma/prisma2/blob/master/docs/releases.md#preview): `2.0.0-preview019` (short: `preview019`). In case you've missed it, you can [read about the current state of Prisma 2 on our blog](https://www.prisma.io/blog/state-of-prisma-2-december-rcrwcqyu655e/).
This release has a number of breaking changes, be sure to read the notes [below](breaking-changes
) before upgrading!
**You can find a full upgrade guide [here](https://github.com/prisma/prisma2/blob/master/docs/upgrade-guides/upgrading-to-preview019.md)**.
Note that we recently adjusted the versioning schema in order to fully comply to the [semver](https://semver.org/) spec (the first release with the new version schema was `2.0.0-preview014`).
Breaking changes
Support for native scalar lists (arrays) in the Prisma schema
Prisma's scalar list support for MySQL and SQLite is removed in this version. For PostgreSQL, Prisma is now mapping scalar lists in the Prisma schema to [PostgreSQL arrays](https://www.postgresql.org/docs/9.1/arrays.html).
Here is an example of a native scalar list (of type `boolean`) in the Prisma schema:
prisma
model User {
id Int id
name String default("")
coinflips Boolean[]
}
You can find the workflows for upgrading Prisma for your database [here](https://github.com/prisma/prisma2/blob/master/docs/upgrade-guides/upgrading-to-preview019.md).
Make ID handling for `Int` and `String` consistent
Previously, the way how Prisma handled IDs was a bit inconsistent. For example, this was allowed:
prisma
model User {
id Int id
}
But this wasn't:
prisma
model User {
id String id
}
There was a difference in how Prisma handled IDs of type `String` and type `Int`.
In the first case, Prisma added the behaviour of auto-incrementing IDs (i.e. IDs received a _default value_), so it wasn't required to provide an `id` value when new `User` records were created via the generated Photon.js API.
The same `User` model with `id` field of type `Int` now **will not** receive any default, auto-incrementing values for `id` any more. Instead `id` values must be explicitly provided when creating new `User` records via Photon.js:
ts
// Before, this was possible
const user = await photon.users.create()
// Now you need to provide an `id`
const user = await photon.users.create({
data: {
id: 42
}
})
In most cases, you'll want to retain the previous functionality though. To get this functionality, you need to add the `default(autoincrement())` to the `id` field:
prisma
model User {
id Int id default(autoincrement())
}
Disallow `id` and `unique` on the same field
Previously it was possible to add `unique` attribute to a field that was already annotated with `id`:
prisma
model User {
id Int id unique
}
This is now forbidden since uniqueness is already implied by `id`:
prisma
model User {
id Int id
}
Breaking change in Lift migrations
This release contains a breaking change to the way how Lift stores the migration history. In order to use Lift with the newest version, you have to:
- manually delete the `migrations` folder from the file system
- truncate or delete Lift's `_Migrations` table, e.g. using `TRUNCATE _Migration;`
Fixes and improvements per Prisma Framework repository
`prisma2`
- [Document unix socket usuage](https://github.com/prisma/prisma2/issues/1121)
- [`lift up` not applying migrations to fresh database, whilst `prisma2 dev` does?](https://github.com/prisma/prisma2/issues/1099)
- [Introspection panic on a non empty database](https://github.com/prisma/prisma2/issues/1092)
- [Introspection panics on an empty database](https://github.com/prisma/prisma2/issues/1087)
- [Prisma 2 init with SQLite works but throws an error](https://github.com/prisma/prisma2/issues/1085)
- [prisma2 init crashing](https://github.com/prisma/prisma2/issues/1068)
- [Document multiple default(now()) restrictions](https://github.com/prisma/prisma2/issues/1062)
- [[Introspection] Panic: FK to non existent table](https://github.com/prisma/prisma2/issues/1107)
- [[Introspection] Remove default from scalar lists](https://github.com/prisma/prisma2/issues/1110)
- [[Introspection] PrismaModels should be able to handle relation field as Id](https://github.com/prisma/prisma2/issues/1115)
- [Could not install prisma2 using volta](https://github.com/prisma/prisma2/issues/1054)
- [Lift and dev, popup to create a new database missing](https://github.com/prisma/prisma2/issues/1051)
- [Automatically clean prisma2 binary cache](https://github.com/prisma/prisma2/issues/988)
- [Rust panic with Chinook and SQLite](https://github.com/prisma/prisma2/issues/975)
- [Improve install behavior on linux](https://github.com/prisma/prisma2/issues/944)
- [prisma2 dev cannot find heroku postgres database](https://github.com/prisma/prisma2/issues/869)
- [Existing database with MySQL doesn't print](https://github.com/prisma/prisma2/issues/778)
- [Error in migration engine when using with sample Chinook dataset](https://github.com/prisma/prisma2/issues/724)
- [Make error text more helpful](https://github.com/prisma/prisma2/issues/693)
- [[Docs] Query Builder](https://github.com/prisma/prisma2/issues/689)
- [Error: Unknown database type postgres:](https://github.com/prisma/prisma2/issues/599)
- [Unix socket connection not working](https://github.com/prisma/prisma2/issues/525)
- [`prisma2` commands could fail more gracefully when query and migration engine are not present](https://github.com/prisma/prisma2/issues/508)
- [Consistent binary names](https://github.com/prisma/prisma2/issues/366)
`photonjs`
- [Photon's error improvement on missing binary](https://github.com/prisma/photonjs/issues/358)
- [Photon facade with netlify](https://github.com/prisma/photonjs/issues/324)
- [Photon facade with zeit now](https://github.com/prisma/photonjs/issues/323)
- [Document Photon and environment variables behavior](https://github.com/prisma/photonjs/issues/354)
- [Make prisma2 an optional peer dependency](https://github.com/prisma/photonjs/issues/313)
- [prisma/photon installation hangs](https://github.com/prisma/photonjs/issues/310)
- [PhotonJS fails to load environment variables from env file](https://github.com/prisma/photonjs/issues/352)
- [Multiple calls to disconnect should be noops](https://github.com/prisma/photonjs/issues/281)
- [Invalid `ctx.photon.posts.create()` invocation](https://github.com/prisma/photonjs/issues/279)
- [Regenerating Photon causes API in development to crash](https://github.com/prisma/photonjs/issues/234)
`lift`
- [Lift is trying to recreate type aliases](https://github.com/prisma/lift/issues/225)
- [Migration Readme Incorrect](https://github.com/prisma/lift/issues/222)
- [Update printMigrationReadme.ts](https://github.com/prisma/lift/pull/198)
- [support <inc|name|timestamp> in up/down cli](https://github.com/prisma/lift/issues/156)
`prisma-engine`
- [[Introspection] "called `Option::unwrap()` on a `None` value", PrismaModels fails on unwrap](https://github.com/prisma/prisma-engine/issues/265)
- [[Introspection] boolean id](https://github.com/prisma/prisma-engine/issues/258)
- [Datamodel Parser: Native Scalar Lists](https://github.com/prisma/prisma-engine/issues/193)
- [EPIC: Native Scalar Lists](https://github.com/prisma/prisma-engine/issues/192)
2.0.0-preview018.2
Fixes
- [Prisma 2 init with SQLite works but throws an error](https://github.com/prisma/prisma2/issues/1085)
- [Could not install prisma2 using volta](https://github.com/prisma/prisma2/issues/1054)
- [Lift and dev, popup to create a new database missing](https://github.com/prisma/prisma2/issues/1051)
- [Make prisma2 an optional peer dependency](https://github.com/prisma/photonjs/pull/313)
- [Migration Readme Incorrect](https://github.com/prisma/lift/issues/222)
- [Automatically clean prisma2 binary cache](https://github.com/prisma/prisma2/issues/988)
- [Multiple calls to disconnect should be noops](https://github.com/prisma/photonjs/issues/281)
- [Invalid `ctx.photon.posts.create()` invocation](https://github.com/prisma/photonjs/issues/279)
- [Update printMigrationReadme.ts](https://github.com/prisma/lift/pull/198)
- [Error: Unknown database type postgres:](https://github.com/prisma/prisma2/issues/599)
- [Unix socket connection not working](https://github.com/prisma/prisma2/issues/525)
- [Lift seems to be broken](https://github.com/prisma/lift/issues/241)
- [Photon facade with zeit now](https://github.com/prisma/photonjs/issues/323)
2.0.0-preview018.1
Fixes
- [prisma2 init crashing 1068](https://github.com/prisma/prisma2/issues/1068)