nijikokun / generate-schema

🧞 Convert JSON Objects to MySQL, JSON Schema, Mongoose, Google BigQuery, Swagger, and more.
MIT License
1.04k stars 136 forks source link

SQL to Prisma generator #65

Open m-abdelwahab opened 3 years ago

m-abdelwahab commented 3 years ago

It would be very nice to have a SQL to prisma generator.

For example the following SQL QUERY

SELECT * FROM Users WHERE city = 'Copenhagen'

Should be converted to the following prisma query

await prisma.users.findMany({
  where: {
      city: "Copenhagen"
  }
})
nijikokun commented 3 years ago

Did a little bit of research since I'm not particularly fluent in prisma.

  1. Model names are PascalCase
  2. Client model names are camelCase
  3. Columns are untouched

Let me know if anything above here is incorrect.


Notes:

m-abdelwahab commented 3 years ago

Everything you mentioned is correct 👍🏼