Match between enum
and text
in relations with Postgres
#2368
Unanswered
stefanosandes
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone!
Based on some tips coming from this issue, I'm trying to implement a polymorphic association like with Drizzle.
My code is something like this:
So, because
notifiableType
is an enum on thenotifications
table and atext
on theusers
table, I'm getting this error:Is there a way to cast the enum when comparing? I tried to do this
fields: [notifications.notifiableId, sql`${notifications.notifiableType}::text`]
, as AI docs suggested, but it doesn't work.Beta Was this translation helpful? Give feedback.
All reactions