-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hey, thanks for this library, it's super promising. I've been using it for schema changes so far, but when I attempted to use it for an actual insert query I hit an issue with my JSONB columns. Is there a way to use JSONB at the moment or is it unsupported?
I had a poke around (after receiving a wtf error from here 😅) and if I hacked the serialization for object I could make it work, though I'm not sure if it's actually the right way to do it:
case "object":
if (Buffer.isBuffer(value))
return {
blobValue: value,
};
else
return {
stringValue: JSON.stringify(value);
};I also wondered about the typeHint property for the SqlParameter, which can be set to JSON to indicate the stringValue contains JSON. I didn't actually do this and it all worked fine anyway, but perhaps the serialize could be updated to return a SqlParameter with the hint rather than just the value itself.
Edit: Ignore the above, it wasn't actually working against a real database, just locally. Ooops.
I'm interested to hear your thoughts on this. I'm happy to send a PR if you can give me some direction.