generate-schema
generate-schema copied to clipboard
SQL to Prisma generator
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"
}
})
Did a little bit of research since I'm not particularly fluent in prisma.
- Model names are PascalCase
- Client model names are camelCase
- Columns are untouched
Let me know if anything above here is incorrect.
Notes:
- Will do PostgreSQL -> Prisma Query as there is an AST parser for it.
- Secondary library might be good for this
generate-queriesor pivot the idea of purely "JSON to X" and more "X to Y" where "Y" could be a "Query Schema"
Everything you mentioned is correct 👍🏼