Reputation: 671
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 ?
Upvotes: 3
Views: 992
Reputation: 906
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!
Upvotes: 0
Reputation: 6559
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.
Upvotes: 4