Refactor version tracking
Refactor version tracking

Make sure to rollback the version number in case we couldn't apply the changes.
Some deduplication of code.

PlanitarInc/migrate,hlandauf/migrate,lepoetemaudit/migrate,jadeydi/migrate,YuukiHogo/migrate,schickling/migrate,yannh/migrate,gunosy/migrate,heetch/migrate,turbine/migrate,jhellan/migrate,buddhamagnet/migrate,Synesis-LLC/migrate,bradley219/migrate,divoxx/migrate