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` then `sql/psql/OMERO5.0__0/OMERO5.0DEV__6.sql`.