fix PL/pgSQL that logs deletes

The previous function made brittle assumptions about table column ordering. To test, make sure that you can delete images from a 4.4 -> 5.0 upgraded DB (upgrade using `sql/psql/OMERO5.0DEV__6/OMERO4.4__0.sql`).