(#2818) - WIP - compaction for attachments

So this is only working for WebSQL at the moment, but I wanted to have some quick remarks:

1) @daleharvey You're right, we should dedup. I was mistaken about how CouchDB works, and I think we benefit more from deduping, especially given browser usage limits.

2) WebSQL was not actually deduping, because we forgot to put an index on `digest`, let alone a unique one. Whoops! :stuck_out_tongue: 

3) This will require a migration.

4) The new tests I wrote are slightly flakey in that they rely on knowing how PouchDB dedupes attachments. I.e., I use 412s and md5 collisions to detect that an attachment was really deleted or not deleted. But assuming we don't plan to ever remove deduping, the tests should be sound.

I'll do IDB and LevelDB tomorrow.