I had a project that was using the latest version of Prisma (3.9.1) and was planning to place a CMS on top of it. Keystone seemed like a very good fit as they already use Prisma internally. Unfortunately I couldn't modify the Prisma schema because it was auto-generated from the Keystone schema. Is there a way to reverse the process and get a Keystone schema from Prisma ?
Asked
Active
Viewed 589 times
2 Answers
4
At the moment there's no way to generate a Keystone schema from an existing Prisma schema. You'd need to create the Keystone schema manually so Keystone could generate a new Prisma schema file.
There's also currently no way to modify the Prisma schema generated by Keystone, though there's been talk of opening this up.

Molomby
- 5,859
- 2
- 34
- 27
-
3I worked on something that at least tries to map the fields from prisma schema to keystone schema. https://github.com/brookmg/prisma2keystone ... – Brook MG Feb 26 '22 at 21:05
-
Hey that's cool, thanks for the link – Molomby Feb 28 '22 at 00:05
0
One option is to paste your Prisma schema into extendedPrismaSchema in keystone/schema.ts as following:
SomeSchema: list({
fields: {},
db: {
extendPrismaSchema() {
return `
model YourSchema {
id String
name String
email String
}
`;
}
}
})
I don't know how this would affect things, but it's one way!

Coco
- 826
- 1
- 12
- 20