Search in sources :

Example 1 with SampleResolver

use of org.flywaydb.sample.resolver.SampleResolver in project flyway by flyway.

the class Main method main.

/**
     * Runs the sample.
     *
     * @param args None supported.
     */
public static void main(String[] args) throws Exception {
    Flyway flyway = new Flyway();
    flyway.setDataSource("jdbc:hsqldb:file:db/flyway_sample;shutdown=true", "SA", "");
    flyway.setLocations("db/migration", "org.flywaydb.sample.migration");
    flyway.setResolvers(new SampleResolver());
    flyway.migrate();
    SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(flyway.getDataSource());
    List<Map<String, Object>> results = jdbcTemplate.queryForList("select name from test_user");
    for (Map<String, Object> result : results) {
        System.out.println("Name: " + result.get("NAME"));
    }
}
Also used : Flyway(org.flywaydb.core.Flyway) SimpleJdbcTemplate(org.springframework.jdbc.core.simple.SimpleJdbcTemplate) SampleResolver(org.flywaydb.sample.resolver.SampleResolver) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Flyway (org.flywaydb.core.Flyway)1 SampleResolver (org.flywaydb.sample.resolver.SampleResolver)1 SimpleJdbcTemplate (org.springframework.jdbc.core.simple.SimpleJdbcTemplate)1