Refactor version tracking

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

Makes it possible to run several queries in each file.