Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client, sdk, cli): integrate breaking changes and update engines #13857

Merged
merged 12 commits into from
Jun 19, 2022
Merged
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
"devDependencies": {
"@prisma/client": "workspace:*",
"@prisma/debug": "workspace:*",
"@prisma/fetch-engine": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c",
"@prisma/fetch-engine": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c",
"@prisma/get-platform": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc",
"@prisma/migrate": "workspace:*",
"@prisma/sdk": "workspace:*",
"@prisma/studio": "0.463.0",
Expand Down Expand Up @@ -120,7 +120,7 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@prisma/engines": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c"
"@prisma/engines": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc"
},
"sideEffects": false
}
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/Doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ it('should fail when db is empty', async () => {
await expect(result).rejects.toThrowErrorMatchingInlineSnapshot(`
P4001

The introspected database was empty: file:dev.db
The introspected database was empty.

`)
})
Expand Down
8 changes: 4 additions & 4 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"@opentelemetry/api": "1.1.0",
"@prisma/debug": "workspace:*",
"@prisma/engine-core": "workspace:*",
"@prisma/engines": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c",
"@prisma/fetch-engine": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c",
"@prisma/engines": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc",
"@prisma/fetch-engine": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c",
"@prisma/get-platform": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc",
"@prisma/migrate": "workspace:*",
"@prisma/sdk": "workspace:*",
"@swc/core": "1.2.203",
Expand Down Expand Up @@ -137,7 +137,7 @@
}
},
"dependencies": {
"@prisma/engines-version": "3.16.0-14.4908cf1dde73491641a0a47fe5f3bebd2430350c"
"@prisma/engines-version": "3.16.0-24.e7e033759b8d20a2a51df5d48adb60b11c6ee4fc"
},
"sideEffects": false
}
14 changes: 7 additions & 7 deletions packages/client/src/__tests__/__helpers__/dmmf-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DMMF } from '@prisma/generator-helper'
import { DMMF } from '@prisma/generator-helper'

const dmmf: DMMF.Document = {
datamodel: {
Expand Down Expand Up @@ -1214,7 +1214,7 @@ const dmmf: DMMF.Document = {
isList: false,
location: 'inputObjectTypes',
namespace: 'prisma',
type: 'UserUpdateOneRequiredWithoutPostsInput',
type: 'UserUpdateOneRequiredWithoutPostsNestedInput',
},
],
isNullable: false,
Expand Down Expand Up @@ -1634,7 +1634,7 @@ const dmmf: DMMF.Document = {
isList: false,
location: 'inputObjectTypes',
namespace: 'prisma',
type: 'PostUpdateManyWithoutAuthorInput',
type: 'PostUpdateManyWithoutAuthorNestedInput',
},
],
isNullable: false,
Expand Down Expand Up @@ -1692,7 +1692,7 @@ const dmmf: DMMF.Document = {
isList: false,
location: 'inputObjectTypes',
namespace: 'prisma',
type: 'PostUncheckedUpdateManyWithoutAuthorInput',
type: 'PostUncheckedUpdateManyWithoutAuthorNestedInput',
},
],
isNullable: false,
Expand Down Expand Up @@ -3215,7 +3215,7 @@ const dmmf: DMMF.Document = {
name: 'update',
},
],
name: 'UserUpdateOneRequiredWithoutPostsInput',
name: 'UserUpdateOneRequiredWithoutPostsNestedInput',
},
{
constraints: {
Expand Down Expand Up @@ -3732,7 +3732,7 @@ const dmmf: DMMF.Document = {
name: 'deleteMany',
},
],
name: 'PostUpdateManyWithoutAuthorInput',
name: 'PostUpdateManyWithoutAuthorNestedInput',
},
{
constraints: {
Expand Down Expand Up @@ -3956,7 +3956,7 @@ const dmmf: DMMF.Document = {
name: 'deleteMany',
},
],
name: 'PostUncheckedUpdateManyWithoutAuthorInput',
name: 'PostUncheckedUpdateManyWithoutAuthorNestedInput',
},
{
constraints: {
Expand Down
13 changes: 12 additions & 1 deletion packages/client/src/__tests__/__snapshots__/json.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,20 @@ Invalid \`prisma.user()\` invocation:

{}

Unknown arg \`hello\` in where.json.hello for type JsonFilter. Did you mean \`select\`? Available args:
Unknown arg \`hello\` in where.json.hello for type JsonFilter. Did you mean \`lt\`? Available args:
type JsonFilter {
equals?: JsonNullValueFilter | Json
path?: List<String>
string_contains?: String
string_starts_with?: String
string_ends_with?: String
array_contains?: Json | Null
array_starts_with?: Json | Null
array_ends_with?: Json | Null
lt?: Json
lte?: Json
gt?: Json
gte?: Json
not?: JsonNullValueFilter | Json
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
}

datasource db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
}

// / User model comment
model User {
id String @id @default(uuid())
email String @unique
// / name comment
name String?
json Json
jsonOpt Json?
posts Post[]
id String @id @default(uuid())
email String @unique
name String?
json Json
jsonOpt Json?
posts Post[]
}

model Post {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
}

// / User model comment
model User {
id String @id @default(uuid())
email String @unique
// / name comment
name String?
json Json
jsonOpt Json?
posts Post[]
id String @id @default(uuid())
email String @unique
name String?
json Json
jsonOpt Json?
posts Post[]
}

model Post {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
output = "@prisma/client"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
output = "@prisma/client"
}

// / User model comment
model User {
id String @id @default(uuid())
email String @unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
output = "@prisma/client"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
output = "@prisma/client"
}

// / User model comment
model User {
id String @id @default(uuid())
email String @unique
Expand Down
6 changes: 2 additions & 4 deletions packages/client/src/__tests__/types/json/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
output = "@prisma/client"
previewFeatures = ["filterJson"]
provider = "prisma-client-js"
output = "@prisma/client"
}

// / User model comment
model User {
id String @id @default(uuid())
email String @unique
Expand Down
6 changes: 3 additions & 3 deletions packages/client/tests/functional/_example/_matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default defineMatrix(() => [
previewFeatures: '"interactiveTransactions"',
},
{
previewFeatures: '"filterJson"',
previewFeatures: '"referentialIntegrity"',
},
],
])
Expand All @@ -63,13 +63,13 @@ export default defineMatrix(() => [
'provider': 'sqlite',
'id': 'Int @id @default(autoincrement())',
'providerFeatures': '',
'previewFeatures': '"filterJson"',
'previewFeatures': '"referentialIntegrity"',
},
{
'provider': 'mongodb',
'id': 'String @id @default(auto()) @map("_id") @db.ObjectId',
'providerFeatures': '"mongoDb", ',
'previewFeatures': '"filterJson"',
'previewFeatures': '"referentialIntegrity"',
},
]
*/
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,4 @@ export default defineMatrix(() => [
provider: 'cockroachdb',
},
],
[
{
previewFeatures: '',
},
{
previewFeatures: '"improvedQueryRaw"',
},
],
])
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { idForProvider } from '../../_utils/idForProvider'
import testMatrix from '../_matrix'

export default testMatrix.setupSchema(({ provider, previewFeatures }) => {
export default testMatrix.setupSchema(({ provider }) => {
return /* Prisma */ `
generator client {
provider = "prisma-client-js"
previewFeatures = [${previewFeatures}]
}

datasource db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,4 @@ export default defineMatrix(() => [
provider: 'cockroachdb',
},
],
[
{
previewFeatures: '',
},
{
previewFeatures: '"improvedQueryRaw"',
},
],
])
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import testMatrix from '../_matrix'

export default testMatrix.setupSchema(({ provider, previewFeatures }) => {
export default testMatrix.setupSchema(({ provider }) => {
return /* Prisma */ `
generator client {
provider = "prisma-client-js"
previewFeatures = [${previewFeatures}]
}

datasource db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import testMatrix from './_matrix'
declare let prisma: import('@prisma/client').PrismaClient

testMatrix.setupTestSuite(
(suiteConfig) => {
() => {
test('query model with multiple fields', async () => {
await prisma.testModel.create({
data: {
Expand All @@ -19,31 +19,16 @@ testMatrix.setupTestSuite(

const testModel = await prisma.$queryRaw`SELECT * FROM "TestModel"`

const backwardCompatible = !suiteConfig['previewFeatures'].includes('improvedQueryRaw')

if (backwardCompatible) {
expect(testModel).toEqual([
{
id: 1,
json: { a: 'b' },
string_list: ['1', 'a', '2', ''],
bInt_list: [-1234, 1234],
date: '2022-05-04',
time: '14:40:06.617',
},
])
} else {
expect(testModel).toEqual([
{
id: 1,
json: { a: 'b' },
string_list: ['1', 'a', '2', ''],
bInt_list: [BigInt('-1234'), BigInt('1234')],
date: new Date('2022-05-04T00:00:00.000Z'),
time: new Date('1970-01-01T14:40:06.617Z'),
},
])
}
expect(testModel).toEqual([
{
id: 1,
json: { a: 'b' },
string_list: ['1', 'a', '2', ''],
bInt_list: [BigInt('-1234'), BigInt('1234')],
date: new Date('2022-05-04T00:00:00.000Z'),
time: new Date('1970-01-01T14:40:06.617Z'),
},
])
})
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,4 @@ export default defineMatrix(() => [
provider: 'sqlserver',
},
],
[
{
previewFeatures: '',
},
{
previewFeatures: '"improvedQueryRaw"',
},
],
])
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import testMatrix from '../_matrix'

export default testMatrix.setupSchema(({ provider, previewFeatures }) => {
export default testMatrix.setupSchema(({ provider }) => {
return /* Prisma */ `
generator client {
provider = "prisma-client-js"
previewFeatures = [${previewFeatures}]
}

datasource db {
Expand Down