2.0.0-beta.8
Pre-releaseToday, we are issuing the eighth Beta release: 2.0.0-beta.8 (short: beta.8).
Breaking change: Splitting .raw into .queryRaw and .executeRaw
When dealing with raw SQL queries, there are two things we care about - the "return payload", which is being calculated by the SELECT statement we use and the number of affected rows - if we for example do an UPDATE query.
Until now, Prisma Client decided under the hood with a heuristic, when to return the number of affected rows and when to return the result data.
This heuristic broke if you wanted the opposite of what the heuristic returned.
That means that the decision has to be made by the developer using Prisma Client instead.
Therefore, we remove the raw command and replace it with executeRaw and queryRaw.
So what does return what?
executeRawreturns the number of affected rowsqueryRawreturns the result data
The heuristic used to return the data for SELECT statements. So if you upgrade to Beta 8, you need to use queryRaw for your SELECT statements and executeRaw for all SQL queries, which mutate data.
The rule of thumb is: Do not use executeRaw for queries that return rows.
In Postgres, it will work to use executeRaw('SELECT 1), however, SQLite will not allow that.
Fixes and improvements
prisma
- Make sure Netlify deployments are not listed with their .netlify.com domain in Google and Co
- .raw doesn't return data if query doesn't start with SELECT statement
- Prisma 2.0.0-beta.7
npx prisma generateissue if working directory contains spaces - JSON type is broken for array. Array comes back as
string. - Error: spawn node --max-old-space-size=8096 .\node_modules@prisma\client\generator-build\index.js ENOENT
- Add a test case for project paths with spaces
prisma-client-js
- Prisma Client removed on adding a new package: Error: @prisma/client did not initialize yet
- JSON types should return a JSON object and not a JavaScript object
- Datasource override from client constructor doesn't match the datasource block from the schema.prisma file
Credits
Huge thanks to @Sytten, @merelinguist for helping!