PrismaP
Prisma3d ago
9 replies
Seb

json types not picked up/generated right for my postgres json field?

I have this in my schema:

datasource db {
  provider = "postgresql"
}

generator client {
  provider     = "prisma-client-js"
  moduleFormat = "cjs"
}

generator json {
  provider = "prisma-json-types-generator"
}

model WorkflowEvent {
  id         String @id @default(uuid())
  /// [WorkflowEventData]
  data Json

  @@index([data(ops: JsonbPathOps)], type: Gin)
}


Then in my prisma-json-types.d.ts:

export type WorkflowEventData = {
  edgeId?: string;
}


These files are located next to each other but they are not on the default path but instead on /libs/db/. This is configured in prisma.config.ts appropriately and everything else works, including migrations.

I also have the dependency installed in my project.

However attempting to insert into the database i'm getting that edgeId doesn't exist on that data. Therefore it does not work.
Was this page helpful?