Use IDTypeAgent and IDTypeWork Job/Agent refs

When referencing Jobs or Agents from another table, use IDTypeAgent or
IDTypeWork, respectively for that column, to avoid a column type
mismatch.

Hopefully this will finally solve the test errors on Travis against
MySQL