Merge change I8e09bde5 into eclair-mr2

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