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
Mmmmmmm, wait, if I set all the types of
any
, I still dont get happy...This is the original default table. The image above is the "userland custom" table.
If I flip the "userland custom" table to use text, we get happy.
That’s maybe a bug
@Dan Kochetov
need to see the full error message to help
add
"noErrorTruncation": true
to tsconfigNot sure if that one is more useful.
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.ts
is the minimum schema
Do y'all want a GH issue to track?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.
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.
weird