Fixes #3162: the migrations are now sorted by their apply time.