Skip to content

Commit

Permalink
chore(deps): version bump prisma 4 (#226)
Browse files Browse the repository at this point in the history
* update deps & fix the prisma schema

* update integration prisma schema

* remove past prisma version support

* add prisma version 4 to past versions test

* comment test-past-prisma while we don't have any past version now

* fix format

* upgrade to prisma 4.1

* remove TODO
  • Loading branch information
AhmedElywa authored Aug 10, 2022
1 parent 684fa20 commit c07b8b1
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
matrix:
os: ['ubuntu-latest']
node-version: [16.x]
prisma-client-version: ['3.10', '3.11', '3.12', '3.13']
prisma-client-version: ['4.0']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"devDependencies": {
"@homer0/prettier-plugin-jsdoc": "^4.0.6",
"@prisma-labs/prettier-config": "0.1.0",
"@prisma/client": "^3.12.0",
"@prisma/sdk": "^3.12.0",
"@prisma/client": "^4.1.0",
"@prisma/internals": "^4.1.0",
"@types/debug": "^4.1.7",
"@types/expand-tilde": "^2.0.0",
"@types/jest": "27.0.3",
Expand Down Expand Up @@ -111,7 +111,7 @@
"nodemon": "^2.0.15",
"object-hash": "^2.2.0",
"prettier": "2.5.0",
"prisma": "3.12.0",
"prisma": "4.1.0",
"read-pkg-up": "7",
"slug": "^5.2.0",
"strip-ansi": "6",
Expand All @@ -124,7 +124,7 @@
},
"prettier": "@prisma-labs/prettier-config",
"peerDependencies": {
"@prisma/client": "^3.10",
"@prisma/client": "^4",
"graphql": "^15 | ^16",
"nexus": "^1.0.0",
"ts-node": "^10.0.0"
Expand All @@ -135,7 +135,7 @@
}
},
"dependencies": {
"@prisma/generator-helper": "^3.12.0",
"@prisma/generator-helper": "^4.1.0",
"debug": "^4.3.3",
"decimal.js": "^10.3.1",
"dindist": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-e2e-db-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const nodeVersionParser = z.union([z.literal('14.x'), z.literal('16.x')])

const osParser = z.union([z.literal('macos-latest'), z.literal('ubuntu-latest'), z.literal('windows-latest')])

const prismaClientParser = z.string().regex(/3.\d+/)
const prismaClientParser = z.string().regex(/4.\d+/)

const connectionStringMapping: Record<ComboCase, string> = {
'14.x + macos-latest': 'node_14_macos_latest',
Expand Down
8 changes: 4 additions & 4 deletions tests/__helpers__/testers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as Path from 'path'
import slug from 'slug'

import { DMMF } from '@prisma/generator-helper'
import * as PrismaSDK from '@prisma/sdk'
import * as PrismaInternals from '@prisma/internals'

import { generateRuntime } from '../../src/generator/generate'
import { Module } from '../../src/generator/helpers/types'
Expand Down Expand Up @@ -141,7 +141,7 @@ export const testGraphqlSchema = (
params: Pick<TestIntegrationParams, 'api' | 'description' | 'database'>
) => {
it(params.description, async () => {
const dmmf = await PrismaSDK.getDMMF({
const dmmf = await PrismaInternals.getDMMF({
datamodel: createPrismaSchema({
content: params.database,
}),
Expand Down Expand Up @@ -199,7 +199,7 @@ export const integrationTest = async (params: TestIntegrationParams) => {
fs.write(`${outputDirPath}/schema.prisma`, prismaSchemaContents)
execa.commandSync(`yarn -s prisma db push --force-reset --schema ${outputDirPath}/schema.prisma`)
fs.copy(sqliteDatabaseFileOutputAbsolute, `${sqliteDatabaseFileOutputAbsolute}.bak`)
dmmf = await PrismaSDK.getDMMF({
dmmf = await PrismaInternals.getDMMF({
datamodel: prismaSchemaContents,
})
fs.write(dmmfFileOutputAbsolute, dmmf)
Expand Down Expand Up @@ -313,7 +313,7 @@ export async function generateModules(
): Promise<{ indexjs_esm: string; indexjs_cjs: string; indexdts: string }> {
const prismaSchemaContents = createPrismaSchema({ content })

const dmmf = await PrismaSDK.getDMMF({
const dmmf = await PrismaInternals.getDMMF({
datamodel: prismaSchemaContents,
})

Expand Down
2 changes: 1 addition & 1 deletion tests/checks/PrismaClientOnContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const base = testIntegrationPartial({
model User {
id String @id
profile Profile @relation(fields: [profileId], references: [id])
profileId String
profileId String @unique
}
model Profile {
id String @id
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/kitchen-sink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ beforeEach(() => {
dotenv: '^9.0.0',
'apollo-server': '^2.24.0',
'cross-env': '^7.0.1',
'@prisma/client': '^3.5.0',
'@prisma/client': '^4.0.0',
'@types/node': '^14.14.32',
graphql: '^15.5.0',
nexus: '1.1.0',
prisma: '^3.5.0',
prisma: '^4.0.0',
'ts-node': '^10.8.1',
'ts-node-dev': '^1.1.6',
typescript: '^4.2.3',
Expand Down Expand Up @@ -120,7 +120,7 @@ it('A full-featured project type checks, generates expected GraphQL schema, and
model Bar {
id String @id
foo Foo? @relation(fields: [fooId], references: [id])
fooId String?
fooId String? @unique
}
// This type "Qux" will not be projected
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ts-node-import-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ it('when project does not have ts-node installed nexus-prisma generator still ge
build: 'prisma generate',
},
dependencies: {
'@prisma/client': '2.30',
'@prisma/client': '4.0.0',
graphql: '15.5.1',
nexus: '1.1.0',
prisma: '2.30',
prisma: '4.0.0',
},
})

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ts-node-unused.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const ctx = konn()
build: 'prisma generate',
},
dependencies: {
'@prisma/client': '2.30',
'@prisma/client': '4.0.0',
graphql: '15.5.1',
nexus: '1.1.0',
prisma: '2.30',
prisma: '4.0.0',
},
})
ctx.fs.write(
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/rejectOnNotFound.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ testIntegration({
description: 'ignores global rejectOnNotFound Prisma Client settings',
database: `
model User {
id String @id
profile Profile? @relation(fields: [profileId], references: [id])
profileId String?
id String @id
profile Profile? @relation(fields: [profileId], references: [id])
profileId String? @unique
}
model Profile {
id String @id
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/relation1To1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const base = testIntegrationPartial({
model User {
id String @id
profile Profile @relation(fields: [profileId], references: [id])
profileId String
profileId String @unique
}
model Profile {
id String @id
Expand Down Expand Up @@ -176,6 +176,7 @@ testIntegration({
profile Profile @relation(fields: [profileId1, profileId2], references: [id1, id2])
profileId1 String
profileId2 String
@@unique([profileId1, profileId2])
}
model Profile {
id1 String
Expand Down
Loading

1 comment on commit c07b8b1

@vercel
Copy link

@vercel vercel bot commented on c07b8b1 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.