Releases: prisma/prisma
2.0.0-preview017.2
2.0.0-preview017.1
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
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
- CLI: Rename Prisma 2 to Prisma Framework
- RecordDoesNotExist Comeback!
- prisma2 init flow is throwing "File name too long"
- Query was empty error on Preview 16
- Type Aliases not working
- Docs for the
postinstall
script of theprisma2
npm package - Document how to build binaries in debug mode
- Remove stability limitation docs
- Error with Prisma v15: can't find prisma.schema
- CodeSandBox core dump investigation
- Error: QueryError(QueryError(UniqueConstraintViolation { field_name: "A, _MovieToWriter" }
- Document native import/export workflows
- End to end testing of CLI init flows
- Contribution documentation: Local setup to be able to develop and use Prisma
- Error: spawn E2BIG
photonjs
- Photon.js not usable with Heroku DB and ZEIT Now V2 due do DB connection limit
- The findOne throws RecordDoesNotExist in alpha.282
lift
prisma-engine
- Build pipeline rework.
- Query engine: integer fields return floats
- Add instructions for compiling binaries in debug mode to README
- Fix joins against the same table when not necessary
- Introspection Engine: Implement and Test
getDatabaseMetadata
andlistDatabases
- Refactoring: Centralize SQL connection handling into central crate
- fix: return type for findMany* should be non-nullable
- Build OS-based binaries instead of platform-based
2.0.0-preview016.2
Fixes
- Fixes #914
2.0.0-preview016.1
Fixes
This release fixes a regression introduced in https://github.com/prisma/prisma2/releases/tag/2.0.0-preview016
2.0.0-preview016
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
- Error While running
prisma2 init hello-prisma
on macOS mojave - Do not count .DS_Store as a file to disqualify a folder during
prisma2 init
with a Starter Kit - Create architecture diagram for the Prisma Framework internals
- Prisma 2 on Centos 7
- Make Prisma generate independent of environment
- Error: spawn E2BIG
- Remove limitation on 1 request at at time
photonjs
- Filtering
null
relationships is not possible - DateTime not converted to Date when using
where
- Array types
prisma-engine
- Introspection Engine: test against our collection of database schema examples
- Introspection Engine: Add support for MySQL
- Introspection Engine: extend tests for MySQL
- Introspection Engine: extend tests for Postgres
- Query Engine: Asyncification
- Query Engine: Find a replacement for our current logger (performance)
- Migration Engine: Implement new diffing approach to enable custom types
2.0.0-preview015
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)
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
- Cursor does not work in
alpha.241
- Docs: Please document how to handle DateTime values with Photon.js
- More inclusive language in docs
- Telemetry: Error report ID
- Postgres: A database with that name doesn't exist at xx.xx.xx.xx using @2.0.0-preview013.3
init
flow doesn't show instruction to navigate into new directory- fix: prisma2 introspect for mysql database
prisma2 dev
: Asks to save changes into a migration file by runningprisma2 lift save
but givesEverything up-to-date
in terminal- Telemetry prompt options don't work on Windows (cursor keys do nothing)
- Limitations: nested write vs. nested mutations
- Conflicting "Make sure to adjust the generator configuration in the schema.prisma file:" error message
- [Windows]
prisma2 init
fails withError: Can't find Python executable "python", you can set the PYTHON env variable.
photonjs
- DateTime should be mapped to Date
.count()
returnsnull
for empty tables- Select in finds methods optional fields
- findOne: Stop throwing an error when no record found
- Possibly wrong type generation for
after
argument in findMany method (Postgres) Field does not exist on enclosing type.
When using most filters (some, etc)
lift
prisma-engine
2.0.0-preview014.2
Fixes
- Postgres: A database with that name doesn't exist at xx.xx.xx.xx using @2.0.0-preview013.3
- Field does not exist on enclosing type.` When using most filters (some, etc)
- init` flow doesn't show instruction to navigate into new directory
- Telemetry: Error report ID
- Select in finds methods optional fields
.count()
returnsnull
for empty tables- README contains wrong link to schema
2.0.0-preview014.1
Fixes
This patch release fixes a bug when using the native
binaryTarget
#750
2.0.0-preview014
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
- Example scripts still use
2.0.0-preview-12
inpackage.json
- "Learn more" link in telemetry modal is broken
- Increase heap size for spawned generator process
- Init flow "printSchema is not a function"
- Support custom SSL certificates in the connection string
- Prisma 2 is failing to migrate remote database (DO hosted instance)
- Prisma lift error: ambiguous self-relation detected
prisma2 init
does not findts-node
when using starter kit "GraphQL API (+ Auth)"- Increase heap size of the generate compilation process
- Rename platforms to binaryTargets
- Streamline generator architecture
- npm install -g prisma2` also downloads migration engine, but doesn't mention it
- Custom binary platforms for query engine