Migrate sql schema to many databases using Flyway

123 Views Asked by At

I'm trying to write a simple Java sample application which uses Flyway to migrate many databases on one IP. When I run this application it completes without error but nothing seems to happen, the schema_version table is not created.

public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("databaseConfig.xml");
    ClientDAO clientDao = ctx.getBean("clientDao", ClientDAO.class);
    List<String> clients = clientDao.getClients();
    Flyway flyway = new Flyway();
    for (String client : clients) {
        flyway.setDataSource("jdbc:mysql://" + STAGE_DB_IP +"/" + client, DB_USER, DB_PASSWORD);
        flyway.baseline();
        flyway.setBaselineOnMigrate(true);
        flyway.migrate();

    }
    System.out.println("Done");
}

The databases already exist with tables.

0

There are 0 best solutions below