Migrated versions should be dumped in order

There is not any guarantees that versions comes in the same order they
are inserted without ordering them explicitely.