Skip to content

[feature] support Unsupported() types #45

@cayter

Description

@cayter

schema.prisma

generator kysely {
  provider           = "prisma-kysely"
  output             = "../../build/prisma/primary"
  fileName           = "types.ts"
  unsupportedFilename = "unsupported-types.ts"
}

model Payment {
  id     BigInt                              @id @default(autoincrement())
  amount Unsupported("money_with_currency")?
}

types.ts (generated by prisma-kysely)

import UnsupportedTypes from '~/unsupported-types';

export type Payment = {
    id: Generated<bigint>;
   amount: UnsupportedTypes['money_with_currency'] | null;
}

unsupported-types.ts (defined by us manually)

export type MoneyWithCurrency = {
  amount: bigint;
  currency: CurrencyCode;
}

export const Unsupported = {
  'money_with_currency': MoneyWithCurrency
} as const;

Would this be possible? We're currently stuck with this and realised that Prisma wouldn't support custom type just for Postgres use case. Would be great if we can make this happen. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions