With postgres as a datasource, prisma will let you use an enum array as a value. Example:
enum UserPermissions {
FOO
BAR
}
model User {
id String @id
permissions UserPermissions[]
}
Unfortunately prisma-kysely generates the array type that the prisma client would return, but in reality the migration/shape prisma would use for this is actually a string, and it's stored as an arbitrary string format: {FOO,BAR}. An empty array would be stored as the string {}
Of course I wouldn't expect kysely to be selecting this string value as an array, so I think it would make the most sense for prisma-kysely to either say "we don't support enum array types" or (ideally) have it generate this array to a string type.
Here's an example of what we could generate:
export type EnumArrayInner<T extends string, All extends string> = T extends infer Single extends string ? T | `${Single},${Exclude<All, Single>}` : never
export type EnumArray<T extends string> = `{${EnumArrayInner<T, T>}}`;
export const UserPermissions = {
FOO: "FOO",
BAR: "BAR"
} as const;
export type UserPermissions = (typeof UserPermissions)[keyof typeof UserPermissions];
export type User = {
id: string;
permissions: EnumArray<UserPermissions>;
}

With postgres as a datasource, prisma will let you use an enum array as a value. Example:
Unfortunately
prisma-kyselygenerates the array type that the prisma client would return, but in reality the migration/shape prisma would use for this is actually a string, and it's stored as an arbitrary string format:{FOO,BAR}. An empty array would be stored as the string{}Of course I wouldn't expect kysely to be selecting this string value as an array, so I think it would make the most sense for prisma-kysely to either say "we don't support enum array types" or (ideally) have it generate this array to a string type.
Here's an example of what we could generate: