percolatestudio / meteor-migrations

Simple migration system for Meteor
https://atmospherejs.com/percolate/migrations
MIT License
245 stars 58 forks source link

Package doesn't work anymore if network failed during migration #49

Closed dearlordylord closed 8 years ago

dearlordylord commented 8 years ago

Reason is you set locked state in db and unset it at the end. If migration didn't end due to network fail, package will continue to be in locked state infinitely unless you unlock with Migrations._collection.update({_id: 'control'}, {$set: {locked: false}}) manually but even then your migration is still 'in the middle', meaning part of data is migrated and another part is not. It is ok if migration script is idempotent though.

zol commented 8 years ago

This case should be rare enough that manual intervention is ok, and in fact, a good thing. Otherwise you could easily miss the fact that your migration only ran part of the way. Using a non-transactional database like Mongo, idempotent migrations are a must.