Closed 0xBigBoss closed 7 months ago
I'd be happy for a change like this to be made! Unfortunately, I don't have huge amounts of time at the minute, but I'd be open to reviewing a PR.
It would have to be backwards-compatible though - I don't fancy a new version number just yet.
Hey @0xBigBoss this should now be much easier. Supawright 0.2.0 can automatically infer enums from the DB, and if your USER-DEFINED
generator returns null
or undefined
, this is the behaviour it'll fall back to.
Our database uses quite a large number of
USER-DEFINED
data types in postgres such asenum
andcitext
. This forces all of them to be handled by oneUSER-DEFINED
generator function.Consider using the
udt_name
when building the tree and using that as the key for the generator function. Reference..)https://github.com/isaacharrisholt/supawright/blob/main/src/tree.ts#L42
That will also allow you to join on the possible enum values.