Transaction per migration session

I create this pull request because i don't know if i will have the time to finish it in the coming weeks, it's fully functional but needs cleanup and testing, maybe someone offers to help