How to implement this dynamic update in Ecto?

I’m using the loop way: Ecto Multi in a Loop

Is there a more effective way?