Add downgrade function to downgrade database with clustered purge

  - provide downgrade functionality in case there is need to downgrade
   database which was modified by builds with clustered purge feature.
   After database is modified by builds with clustered purge feature,
   the disk version is bumped to 7. Also, there are two newly introduced
   trees: PurgeTreeState and PurgeSeqTreeState.

   Once downgrade function is called, the disk version is back to the
   latest version of current build. Also, purge_seq and purged_docs
   are re-introduced again.

COUCHDB-3226

Add test
7 files changed