Hi guys, how can I use updateMany to update an ent...
# orm-help
m
Hi guys, how can I use updateMany to update an entity, and then create an entity that has a one-to-many relationship with it? eg: Say I have a 'Rules' table and a flag that I want to set to 'true' for a bunch of ID's. 'Rules' has a 1-M relationship with another table called 'Version' which keeps version details. Every time I update 'Rule' I want to create a new entry in 'Version' Thought I could do something like: prisma.rules.updateMany({ data: { Flag: true, Version: { create: { AnotherFlag: true } } } }) But no luck
d
I believe you are missing a "where", in your updateMany, and in the create, I believe you would have to pass all the necessary data to create a new version
r
@Moh πŸ‘‹ Updating relations inside
updateMany
isn’t supported yet. It would be great if you could add a πŸ‘ to this request so that we can look at the priority πŸ™‚ As a workaround, multiple requests in a transaction should do the trick.
πŸ‘ 1