Database switching

The essentials to switch between databases is in this PR.  Needs to be cleaned up and more rigorously tested, but it does seem to work in rails console.  Ideally use some metaprogramming (via method_missing) to extend the visit_action class methods to *_using_logdb -- this would automatically switch to the log.sqlite3 db, run super and then switch back.  The option ought to be explored more as it would save a lot of code rewriting.