Merge change I7f61664c into eclair-mr2

* changes:
  change BEFORE triggers to AFTER triggers - to make them work with sqlite 3.6.20 & beyond