Fix: Bug in generating migrations

Closes #461