When altering from e.g. an IntegerField to a ForeignKey, Django didn't add a constraint. Backport of f4f0060f from master