Fix migration to do not depend on the models directly

This would cause migration to fail as coloumns might not even exist at
that point.