Skip to content

implement missing nested set operation #18

@schoero

Description

@schoero

Prisma has a nested set operation to connect the provided relations while disconnecting previous ones.

It is not very well documented, the only reference I found apart from the type definitions is this: https://www.prisma.io/docs/orm/prisma-client/queries/relation-queries#disconnect-all-related-records

Disconnect all related records

To disconnect all related records in a one-to-many relation > (a user has many posts), set the relation to an empty list as shown:

const result = await prisma.user.update({
  where: {
    id: 16,
  },
  data: {
    posts: {
      set: [],
    },
  },
  include: {
    posts: true,
  },
})

The library is currently missing the nested set operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions