Skip to content

[BUG] Missing relation attributes from createMany and createManyAndReturn #1712

@Tsimopak

Description

@Tsimopak

createMany and createManyAndReturn misses relation attributes, although they can be used.
An example,

If I have the following schema:

model House {
  id Int @id @default(autoincrement())
  doorTypeId Int
  door Door @relation(fields: [doorTypeId], references: [id])
  windows Window[]
  type String
  @@delegate(type)

}

model PrivateHouse extends House {
  card Int

}
model Skyscraper extends House {
  ticket Int

}

model Door {
  id Int @id @default(autoincrement())
  color String
  houses House[]
  type String
  @@delegate(type)

}


model IronDoor extends Door {
  strength Int

}

model WoodenDoor extends Door {
  texture String

}

model Window {
  id Int @id @default(autoincrement())
  houses House[]
}

And let's say I try to add a new houses using the createMany or createManyAndReturn api, see what options it gives me:
image

^ No windows option, even though it is possible to make multiple connect, as i mentioned if i ignore this typing error it still works, it's just the typing that is messed up.

Another example, if I want to connect a door:
image

I can only use doorTypeId, but from some reason it's not showing me the option to do that as safely by:

data: {
  door: {
     connect: id
  }
}

Versions:

  "devDependencies": {
    "prisma": "^5.19.1",
    "typescript": "^5.6.2",
    "zenstack": "2.5.1"
  },
  "dependencies": {
    "@prisma/client": "^5.19.1",
    "@zenstackhq/runtime": "2.5.1"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions