Fix foreign key type for has-many associations