Allow to specify a type for foreign key column in migrations

[Andrey Novikov & Łukasz Sarnacki]

This is a backport commit from master to support types in references calls in migrations.