Skip to content
Discussion options

You must be logged in to vote

Hey @rodolphoasb 👋
In this particular use case, I don't think the updateMany method would work. updateMany is for updating many records with the same data.
For your use case, you would need to use two separate update calls.
Something like this:

await prisma.todoGroup.update({
      where: {
        order: 1,
      },
      data: { order: 2 },
    });

await prisma.todoGroup.update({
      where: {
        order: 2,
      },
      data: { order: 1 },
    }); 

Transactions can also be useful for your use case.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rodolphoasb
Comment options

@nurul3101
Comment options

Answer selected by jharrell
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants