MySQL varchar gets inferred as MySqlText?

next-auth adapter help again. Is this my bug or Drizzle's? (Probably Drizzle's because Drizzle STINKS) TL;DR: MySQL varchars are getting inferred as MySqlText. Part of the requirements of next-auth is to provide a minimum schema but also let folks extend off of it. So, I have a minimum schema built for MySQL and am inferring it's type. But it looks to me like the inferred type of MySQL's varchar becomes MySqlText when it gets inferred. The problem with this ends up being that, when folks want to provide their custom table with the varchar (which is correct) they get an error because TS thinks it's supposed to be a MySqlText.
10 Replies
anthonyshew
anthonyshewOP2y ago
Mmmmmmm, wait, if I set all the types of any, I still dont get happy...
anthonyshew
anthonyshewOP2y ago
This is the original default table. The image above is the "userland custom" table.
anthonyshew
anthonyshewOP2y ago
If I flip the "userland custom" table to use text, we get happy.
Andrii Sherman
That’s maybe a bug @Dan Kochetov
Dan
Dan2y ago
need to see the full error message to help add "noErrorTruncation": true to tsconfig
anthonyshew
anthonyshewOP2y ago
Not sure if that one is more useful.
anthonyshew
anthonyshewOP2y ago
If you want to get dirty with it: - https://github.com/nextauthjs/next-auth/pull/7165 - Line 45 of packages/adapter-drizzle/tests/mysql/custom.test.ts - Same file, line 8, is someone making a custom users table - Line 15 of packages/adapter-drizzle/src/mysql/index.tsis the minimum schema Do y'all want a GH issue to track?
Dan
Dan2y ago
Based on the error, it looks like you're trying to assign a varchar column to a text column. I think you had this error before in another thread. or, rather, passing a table with a certain column of type varchar to a place which expects a table with that column of type text instead.
anthonyshew
anthonyshewOP2y ago
The table that I’m inferring from is using varchar. Then I try to use the same table on it’s own inferred type and it’s not allowed. The only way to get it to pass is by changing it to text.
Dan
Dan2y ago
weird
Want results from more Discord servers?
Add your server