3

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 ?

Brook MG
  • 601
  • 10
  • 20

2 Answers2

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
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