Skip to content

update: support prisma version 6.19 - #494

Open
anyuan-chen wants to merge 3 commits into
MichalLytek:mainfrom
anyuan-chen:main
Open

update: support prisma version 6.19#494
anyuan-chen wants to merge 3 commits into
MichalLytek:mainfrom
anyuan-chen:main

Conversation

@anyuan-chen

@anyuan-chen anyuan-chen commented Mar 3, 2026

Copy link
Copy Markdown

This PR updates the DMMF generation to support DMMF outputted from Prisma 6.19. It also adds supports for the new clients and aliasing Prisma introduced since ver 5.

I use this project as part of Hack the North, a student run hackathon, and our backend is coupled extremely tightly to this framework and GQL as a whole. We've been on Prisma 5 for a while and would like to move to Prisma 6, which is why I am sending this patch.

I spent a decent amount of time reading DMMF and this repo to familarize myself with the general structure/logic behind generation, so I could police my coding agent when I was using it.

AI Usage:

This final PR was constructed with the help of agents, with careful and thoughtful human supervision.
My approach was to find the 2 commits where Prisma 5 left off, then find out where 6.19 was. For each of the commits, I asked the agent to collect the changes in the DMMF, and write it to a SQL db with the commit hash. I then had another coding agent go over each of those hashes and scan this repo for areas where it could apply changes.

I then confirmed the changes myself by hand in the main Prisma repo by looking at the PRs. I looked for tests to add where I felt appropriate, and instructed the agent to add them.

I did not update experiments or examples.

cwdDirPath + "/generated/type-graphql",
);

expect(prismaGenerateResult.stderr).toHaveLength(0);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

.replace("UpdateMany", "")
.replace("AndReturnOutputType", ""),
);
return `UpdateManyAndReturn${modelTypeName}`;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

createOneUser(data: UserCreateInput): User!
deleteManyPost(where: PostWhereInput): AffectedRowsOutput!
deleteManyUser(where: UserWhereInput): AffectedRowsOutput!
deleteManyPost(limit: Int, where: PostWhereInput): AffectedRowsOutput!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

updateManyUser(data: UserUpdateManyMutationInput!, where: UserWhereInput): AffectedRowsOutput!
updateManyAndReturnPost(data: PostUpdateManyMutationInput!, limit: Int, where: PostWhereInput): [UpdateManyAndReturnPost!]!
updateManyAndReturnUser(data: UserUpdateManyMutationInput!, limit: Int, where: UserWhereInput): [UpdateManyAndReturnUser!]!
updateManyPost(data: PostUpdateManyMutationInput!, limit: Int, where: PostWhereInput): AffectedRowsOutput!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@anyuan-chen

Copy link
Copy Markdown
Author

@MichalLytek Please take a look!

@simonjoom

simonjoom commented Jun 14, 2026

Copy link
Copy Markdown

Thks for this merge,
i did use it, and work for me

Just i ve some issue using enum directly in the schema, the compilation get some error because enum is defined in prisma 6 and in generated code..
For me the cleaner was to change reference to enum from the generation code toward prisma (like in file EnumRolefilter.ts)

import { Prisma,roles } from "@prisma/client"; //roles added here
import { DecimalJSScalar } from "../../scalars";
import { NestedEnumrolesFilter } from "../inputs/NestedEnumrolesFilter";
//import { roles } from "../../enums/roles1"; //roles commented here

and add manually

registerEnumType(roles, {
name: "roles",
}); //because Prisma do not register it

in my main file entrypoint

My main raison is i use this code:


import { PrismaClient } from '@prisma/client'
import type Prisma from '@prisma/client' 
import type express from 'express';

export interface ContextValue {
  prisma: PrismaClient
  User: Partial<Prisma.User> 
  req: express.Request;
  res: express.Response;
}

I cannot use graphql here with my context and also because i use Partial from typescript, so any reference to roles find duplicated with generated code.

i just write my changes here if anyone see the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants