Prisma: 2.0.0-preview015 Release

Release date:
October 22, 2019
Previous version:
2.0.0-preview014.2 (released October 16, 2019)
Magnitude:
1,071 Diff Delta
Contributors:
7 total committers
Data confidence:
Commits:

23 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Authored October 18, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 17, 2019
Authored October 21, 2019
Authored October 21, 2019
Authored October 21, 2019
Authored October 17, 2019
Authored October 21, 2019
Authored October 22, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 18, 2019
Authored October 17, 2019
Authored October 16, 2019
Authored October 16, 2019
Authored October 16, 2019
Authored October 16, 2019
Authored October 21, 2019

Top Contributors in 2.0.0-preview015

nikolasburk
wardpeet
timsuchanek
divyendu-singh-cb07
madebysid
joon1030
INovozhilov

Directory Browser for 2.0.0-preview015

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

Today, we are issuing the fifteenth Preview release: 2.0.0-preview015 (short: preview015).

Note that we recently adjusted the versioning schema in order to fully comply to the semver spec (the first release with the new version schema was 2.0.0-preview014).

Major changes

Lift now features an explicit UI that warns about destructive changes before performing a schema migration: (Right now column and table dropping are recognized)

<img width="977" alt="Screenshot 2019-10-22 at 16 19 26" src="https://user-images.githubusercontent.com/4058327/67297589-683f1500-f4ea-11e9-8c3c-849994e5a81c.png">

Breaking changes

Photon.js now maps DateTime from the Prisma schema to Date in JavaScript

Assume you have the following Prisma model:

model Post {
  id        String   @default(cuid()) @id @unique
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
}

The Photon.js generator now sets the types of the createdAt and updatedAt fields to Date instead of string:

export declare type Post = {
    id: string;
    createdAt: Date;
    updatedAt: Date;
    title: string;
}

findOne doesn't throw any more but has optional return type

Based on this issue, we decided to adjust the Photon.js API for findOne calls. Instead of throwing an exception when there is no record that meets the specified where condition for a findOne call, it now returns null.

Assume again the same Prisma model as before:

model Post {
  id        String   @default(cuid()) @id @unique
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
}

So, in your application code you might want to adjust the catch calls to explicit checks for null:

Before

try {
  const post = await photon.posts.findOne({
    where: { id }
  })
  // ... do something with `post`
} catch(e) {
  console.log(`Did not find record with ID: ${id}`)
}

After

const post = await photon.posts.findOne({
  where: { id }
})
if (post === null) {
  console.log(`Did not find record with ID: ${id}`)
  return
}
// ... do something with `post`

Fixes and improvements per Prisma Framework repository

prisma2

photonjs

lift

prisma-engine