Revert "Use topological sort for migration operation dependency resolution"

This commit broke the tests on Python 3.

This reverts commit 13d613f80011852404198dfafd1f09c0c0ea42e6.