Changes workflow population to work in batches.

Somehow the longer queries did not fit into the query buffer. I believe
my query buffer to be pretty default, which is why I favor to split the
queries into smaller chunks.
Adds migration for mysql
Merge pull request #678 from opf/fix/mysql-migration

[WIP] Fix/mysql migration