Add type field to relation