percolatestudio / meteor-migrations

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

Fix for "Not migrating, control is locked." which may happen when {locked: "false"} instead of {locked: false} #7

Closed lestephane closed 9 years ago

lestephane commented 10 years ago

I regularly reset the locked flag with Robomongo. For lack of sleep i yesterday reset it with the value "false" (a String) instead of false (a boolean). The result: meteor-migrations refused to perform the migration, again and again, saying "Not migrating, control is locked.", and I could have torn my eyeballs out for an hour, not understanding what I was doing wrong. I think this patch will help everyone keep their sanity. I love this package, so keep it up! Would love the successive migration steps (and their failed attempts) to be logged to the migrations table to assist troubleshooting, in terms of establishing a single source of truth when it comes to the migration timeline. Other than that, very happy with it.

JamesMGreene commented 9 years ago

What if you set it to "true", though? :)

If any change is going to be made (personally, I think I would just recommend against this PR altogether), something like the following would probably be safest:

if (("" + control.locked) === "true") {
zol commented 9 years ago

Thanks @djlestephane . Since the common scenario is a user trying to unlock a locked state, I think this is a reasonable change. I'll merge it and have it go out with the next release. @JamesMGreene - I can't think of a scenario when a user would want to lock the state themselves.