Fixes to indexed db persistence and upgrade logic

After manual testing of the adapter logic, i fixed some errors.  To use
the adapter your web page needs to include that script.  See comments in
idbAdapter.js for examples.