String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME);
String connectionPassword = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_PASSWORD);
// We migrate automatically => if you do not want that (eg in production)
// set ninja.migration.run=false in application.conf
Flyway flyway = new Flyway();
flyway.setDataSource(connectionUrl, connectionUsername, connectionPassword);
// In testmode we are cleaning the database so that subsequent testcases
// get a fresh database.
if (ninjaProperties.isTest()) {
flyway.clean();
}
flyway.migrate();
}
}