Fix counter/sum cache and touch triggers when foreign key column modified, bump version to 1.0.6

The counter/sum cache and touch triggers did not handle cases
where the foreign key was modified previously.  This makes it
handles those cases.

The basic idea is simple.  If the foreign key changes, process
the row as an insert of the new row and a delete of the old row.

While here, DRY up the related code so it is easier to understand.