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
Done