valtyr / prisma-kysely

🪄 Generate Kysely types directly from your Prisma schema!
https://www.npmjs.com/package/prisma-kysely
MIT License
914 stars 35 forks source link

SQL Server Support? #65

Closed BStoller closed 4 months ago

BStoller commented 1 year ago

@valtyr would this library support interpreting Prisma SQL Server Schemas? I am implementing a custom kysely dialect and wanted to check to see if I could use this library

dylel commented 1 year ago

I've tried using sql server, for some reason this doesn't seem to be supported. I just get

spawn prisma-kysely ENOENT

Not sure why this needs to be dialect specific, shouldn't this just look at the types?

valtyr commented 1 year ago

Hey there, the types are different for each driver. I'm all for supporting SQL Server, we just need to provide a type map for the dialect.

It should be enough to add a type map in the generateFieldType file (https://github.com/valtyr/prisma-kysely/blob/main/src/helpers/generateFieldType.ts) and add SQLServer as a valid option in the config validator (https://github.com/valtyr/prisma-kysely/blob/main/src/utils/validateConfig.ts). If you were willing to submit a PR that would be awesome.

valtyr commented 1 year ago

Let me know you run into any issues or if I can be of any help @BStoller

dylel commented 1 year ago

I've submitted a pr #68 for this change, honestly a little unsure on the type mapping but seems good