Skip to content

Releases: prisma/prisma

2.0.0-preview017.2

2.0.0-preview017.1

27 Nov 13:17
Compare
Choose a tag to compare
2.0.0-preview017.1 Pre-release
Pre-release

Fixes

As the last preview release Preview 17 introduced a lot of change with a lot of potential side effects, also a few small bugs got introduced.

These bugs are fixed by this patch.

The issues that got tackled by this patch:

2.0.0-preview017

25 Nov 15:41
Compare
Choose a tag to compare
2.0.0-preview017 Pre-release
Pre-release

Today, we are issuing the seventeenth Preview release: 2.0.0-preview017 (short: preview017). Note that this release includes a major breaking change with respect to where Photon.js is being generated and how it's imported into your code. Read more below!

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

Breaking changes

Photon.js generation and usage

With this release, we're implementing the facade package @prisma/photon for Photon.js. This means, instead of generating Photon.js into node_modules/@generated/photon, it is now being generated into node_modules/@prisma/photon.

Furthermore, you now must add the @prisma/photon package to your project dependencies:

npm install @prisma/photon

Consequently, the Photon constructor is now imported from @prisma/photon into your code:

- import { Photon } from '@generated/photon'
+ import { Photon } from '@prisma/photon'

Also note that the versions of @prisma/photon and your prisma2 CLI installation must be the same! It is therefore recommended to add prisma2 as a development dependency to you project. Global installations of prisma2 are discouraged because it's more difficult to keep them in sync with individual projects.

You can add prisma2 as a development dependeency as follows:

npm install prisma2 --save-dev

You can now invoke this local prisma2 installation using npx:

npx prisma2

Usage of custom binaries in Photon.js

If you're using the platforms field on your Photon.js generator to explicitly specify a build target for the binaries that are used by Photon.js, you might need to update the naming of the binaries. Here's how the names have changed:

Before After
windows windows
darwin darwin
linux-glibc-libssl1.0.1 debian-openssl-1.0.x
linux-glibc-libssl1.0.2 debian-openssl-1.0.x
linux-glibc-libssl1.1.0 debian-openssl-1.1.x
linux-glibc-libssl1.1.1 debian-openssl-1.1.x

If you're using a RHEL-based systems (Fedora, Centos, etc.), replace debian with rhel, e.g. rhel-openssl-1.1.x.

You can learn more about this in the spec.

Fixes and improvements per Prisma Framework repository

prisma2

photonjs

lift

prisma-engine

2.0.0-preview016.2

11 Nov 12:11
Compare
Choose a tag to compare
2.0.0-preview016.2 Pre-release
Pre-release

Fixes

2.0.0-preview016.1

08 Nov 11:37
Compare
Choose a tag to compare

2.0.0-preview016

07 Nov 17:21
Compare
Choose a tag to compare
2.0.0-preview016 Pre-release
Pre-release

Today, we are issuing the sixteenth Preview release: 2.0.0-preview016 (short: preview016).

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

Also a huge shoutout to @williamluke4 for his work on this PR: fix(Engine Commands) Pass JSON File to Query Engine 🙌

Major changes

This release contains major improvements to Photon's query engine. The biggest improvement here is that we're lifting the limitation that the query engine is only able to process one request at a time. In practice, this means that the query engine request throughput vastly increases. We see this as a major step towards making Photon.js production-ready! 🎉

Breaking changes

Due to a major refactoring in Lift's migration engine, your migrations are likely going to break if you upgrade to preview016 with an error similar to this: Error parsing the migration steps: Error("unknown field 'name', expected 'model'", line: 1, column: 59).

To get rid of this error, you'll need to manually delete the generated migrations folder from your file system and drop the _Migration table in your database.

Fixes and improvements per Prisma Framework repository

prisma2

photonjs

prisma-engine

2.0.0-preview015

22 Oct 16:10
f597813
Compare
Choose a tag to compare
2.0.0-preview015 Pre-release
Pre-release

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)

Screenshot 2019-10-22 at 16 19 26

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

2.0.0-preview014.2

2.0.0-preview014.1

14 Oct 10:12
Compare
Choose a tag to compare
2.0.0-preview014.1 Pre-release
Pre-release

Fixes

This patch release fixes a bug when using the native binaryTarget #750

2.0.0-preview014

11 Oct 16:39
Compare
Choose a tag to compare
2.0.0-preview014 Pre-release
Pre-release

Today, we are issuing the fourteenth Preview release: 2.0.0-preview014 (short: preview014).

Note that we adjusted the versioning schema (from 2.0.0-preview-14 to 2.0.0-preview014) in order to fully comply to the semver spec.

Breaking changes

Removing the nexus-prisma generator from the Prisma schema

In version 2.0.0-preview014, the nexus-prisma generator is not available any more. When using nexus-prisma, you can install it as an npm dependency, just like you do with other libraries. Find an updated example of how to using nexus-prisma to build a GraphQL API here.

Self-relations must be disambiguated with the @relation attribute

In previous releases, this used to be a valid schema:

model User {
  id         String @id @default(cuid())
  marriedTo  User?
  spouseOf   User?
}

In previous versions, it was inferred that both relation fields, marriedTo and spouseOf, would belong to the same relation, i.e. it was interpreted as follows:

model User {
  id         String @id @default(cuid())
  marriedTo  User? @relation("MarriedUsers")
  spouseOf   User? @relation("MarriedUsers")
}

From this release onwards, adding the @relation attribute is required in order to disambiguate this relation.

The platforms field of generators in the schema has been renamed to binaryTargets

generator photon {
  provider = "photonjs"
  platforms = ["darwin"]
}

now becomes

generator photon {
  provider = "photonjs"
  binaryTargets = ["darwin"]
}

pinnedPlatform is now an env var

If you want to specify the concrete binary target or a binary path for the query engine, you can use the PRISMA_QUERY_ENGINE_BINARY env var. Just pass it in to the process running Photon.js and it will be picked up.

In order to also customize the Lift engine path, you can run the prisma2 cli while providing PRISMA_MIGRATION_ENGINE_BINARY.

Major changes

For this release, we have invested a lot into fixing bugs across the stack. Try it out yourself:

npm install -g prisma2
prisma2 init hello-world

Please share your feedback and report any issues you might encounter!

Fixes and improvements per Prisma 2 repository

prisma2

photonjs

lift

studio

prisma-engine