How to use DoUpdate with a TypeConverter field #1556
-
I'm trying to "upsert" using the onConflict feature. However, I'm applying the upsert against a table with a TypeConverter on the column. This question may be related to #1158. When I try to use the Companion.custom() object to resolve the conflict, I get the following error message
Here is my minimal example
Driver
It seems that the Companion objects don't leverage the TypeConverter, but I cannot find how to proceed with the update. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It's true that the So, until the next major release, it looks like you'll have to work around this with |
Beta Was this translation helpful? Give feedback.
It's true that the
.custom
companion constructor doesn't support type converters. It can't, really: TheExpression
passed can be any SQL value and it's not obvious how a type converter might be applied to that. Ideally, the companion should expect anExpression<int>
here as that's the type in the database. This was an oversight from my side, but it's a breaking change to fix.So, until the next major release, it looks like you'll have to work around this with
number: Variable(2).dartCast()
. Sorry for the inconvenience, it will get better :D