Fix #1409

This pullrequest changes the logic of `Migrator.prototype.getUndoneMigrations`.

It queries all the migrations that happened in the database and then compares these IDs with the IDs found in the migrations folder.

It then executes all the migrations it could not find, up to a specified to ID, if given.