Skip to content
Advertisement

sequelize updating multiple rows

Update multiple rows , is using a bulk update a good solution or something like the code below works ? . I supposed wanted to update all the records with the id and filename.

I did try to update inside a loop but the migration hang up and take too long in this block. is it because of the iterations ? or is there something wrong with the update syntax?. Thank you.

#Code

#CODE

Advertisement

Answer

I think the biggest issue is that each update is waiting on the previous to complete:

If you change it to:

you should see a big speedup.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement