Fix string/integer conversions in migrations.

This is for postgres compatibility.