albingroen / prismabuilder.io

Build your Prisma schema visually in this easy-to-use web based tool
https://www.prismabuilder.io
285 stars 31 forks source link

Add MongoDB ! #69

Open MTGPROD opened 1 year ago

MTGPROD commented 1 year ago

Hi, I love the idea behind your tool, but... It didn't supports mongodb.

sonylomo commented 1 year ago

Hey @albingroen 👋🏾

I was taking a stab at this and I've come up with "Easy fixes" that would currently distinguish MongoDB schema from the SQL databases:

  1. Appending @id @default(auto()) @map("_id") @db.ObjectId to the id attribute of a MongoDB model by default.
  2. MongoDB id attribute should always be aString.
  3. m-m relations in MongoDB should have @relation(references: [id])

I can try implementing this as a placeholder before support for database native type attributes is added to Prisma Builder.

WDYT?

albingroen commented 1 year ago

@sonylomo I am hesitant to change the json>prisma<json engine that I currently have since it's very hacky. Some people on your team have promised a first-party utility for precisely that, so I will be holding off and then rewrite the backend once that's available :)