drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[MySQL/Pg/SQLite] Fix drizzle-zod not enforcing string lengths

Open TiltedToast opened this issue 1 year ago • 0 comments

Every varchar/char was treated as an enum so the proper checks were never applied. Also split them up so chars have a fixed length and varchar's a max length. This should fix https://github.com/drizzle-team/drizzle-orm/issues/577

I'm not 100% sure what to do with MySqlBinary since as far as I understand the database will pad it in order for it to fit the required length. This shouldn't be an issue when just retrieving the data from the database, but there's no way to verify the length when inserting since the db will do that after you give it the string.

MySqlVarBinary is also tricky since MySQL checks for the bytes rather than string length when inserting this. Maybe zod already takes care of this, if it does it'd probably be fine to set the max length I'd imagine.

TiltedToast avatar Jun 02 '23 01:06 TiltedToast