omar-dulaimi / prisma-class-validator-generator

Prisma 2+ generator to emit typescript models of your database with class validator
MIT License
65 stars 11 forks source link

Add support for Bytes/Buffer type #15

Closed austenstrine closed 2 months ago

austenstrine commented 2 months ago

The current version does not support correctly generating binary data types (Bytes).

Attempting to add a Bytes data type into the schema.prisma and then run npx prisma generate results in errors in the generated classes that have Bytes.

I added a 'Bytes' to 'Buffer' case in the getTSDataTypeFromFieldType() function in helpers.js, and this resolved the error correctly.

No import needed since Buffer is a globally supported type.