@jurisicmarko
March 2016
"Continuous Database Integration (CDBI) is the process of
rebuilding your database and test data any time a change is
applied to a project's version control repository“
(P. M. Duvall, S. Matyas, A. Glover, Continuous Integration)
And a few dead projects:
dbdeploy (2009), MIGRATEdb (2014), migrate4j (2008), dbmaintain (2011), AutoPatch (2014)
https://en.wikipedia.org/wiki/Schema_migration
https://flywaydb.org/getstarted/how
https://flywaydb.org/getstarted/how
Flyway flyway = new Flyway();
flyway.setDataSource(url, user, password);
flyway.migrate();
@Configuration
public class PersistenceConfiguration {
@Bean
@DependsOn("flyway")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
// do hibernate init
}
@Bean
public Flyway flyway() {
Flyway flyway = new Flyway();
flyway.repair();
flyway.migrate();
return flyway;
}
}
package db.migration;
import org.flywaydb.core.api.migration.spring.SpringJdbcMigration;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Example of a Spring Jdbc migration.
*/
public class V1_2__Another_user implements SpringJdbcMigration {
public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
jdbcTemplate.execute("INSERT INTO test_user (name) VALUES ('Obelix')");
}
}