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/570
Please add a test to verify the correct behaviour on rollback in the error case.