Use topological sort for migration operation dependency resolution

rather than an ad-hoc algorithm

The topological sort was included from https://bitbucket.org/ericvsmith/toposort
I imagine that this is preferred over creating creating a dependency.