Improve v2 database migration.