Open pimeys opened 3 years ago
@pimeys This looks great! Just what I have been looking for to add query support to enum types. Anything I can do to help fast track this PR?
@pimeys Slight correction in postgres visitor (Not sure about other databases), the custom type name should be double quoted.
let comparison = "kind".equals(value.cast_as("UserKind"));
The query output is:
SELECT
"public"."users".*
FROM
"public"."users"
WHERE
"kind" = ($1) :: UserKind # I know crazy type name, but sometimes external databases have stuff like this
UserKind
will actually be converted to userkind
by postgres. To avoid this the type must be quoted. "\"UserKind\""
. The CastType::Custom
should automatically quote the typenames.
This whole issue is on hold now due to not having time in any team and if we merge this, we'll break our main product (it needs to get the corresponding PR finished and merged)...
Ah, understood. Thanks, I'll try something at my end.
Part of: https://github.com/prisma/prisma/issues/6902