Db migrations 2

Added tests for the database migration procedure (https://bugs.launchpad.net/oq-engine/+bug/1294566).
Everything is green: https://ci.openquake.org/job/zdevel_oq-engine/571
It can be made not necessary with a small change to oq_create_db. Done.