Marek
Marek

Reputation: 7433

Flyway migration file is not picked up

Project currently contains 4 sql migration files, but the latest migration file ddl/V201406161418__Add_tracking_codes.sql is not picked up.

Migration are run by this method (error handling removed):

@PostConstruct
private void onStartup() {
    Flyway flyway = new Flyway();
    flyway.setInitOnMigrate(true);
    flyway.setLocations(getLocations()); // abstract String[] getLocations()
    flyway.setOutOfOrder(true);
    flyway.setTable(getTable()); // abstract String getTable()

    for(DataSource ds : getDataSources()) { // abstract List<DataSource> getDataSources()
        flyway.setDataSource(ds);
        flyway.repair();
        for (MigrationInfo i : flyway.info().all()) {
            log.info("migrate task: " + i.getVersion() + " : "
                    + i.getDescription() + " from file: " + i.getScript());
        }
        flyway.migrate();
    }
}

This is what I see in logs:

migrate task: 201405131722 : Initial schema from file: ddl/V201405131722__Initial_schema.sql

migrate task: 201405131734 : Initial product data from file: cfg/V201405131734__Initial_product_data.sql

migrate task: 201406091356 : Fee increase from file: cfg/V201406091356__Fee_increase.sql

2014-06-16 16:01:58 WARN DbMigrate:47 - outOfOrder mode is active. Migration of schema ncsp may not be reproducible.

2014-06-16 16:01:58 INFO DbMigrate:43 - Schema ncsp is up to date. No migration necessary.

As you see, there's a migration file picked up in the very same directory. I can see the file is deployed on glassfish server.

Is there another reason it's ignored that I don't see?

Upvotes: 1

Views: 1038

Answers (1)

Marek
Marek

Reputation: 7433

Turns out it was JRebel that I'm testing. It took over resource loading and instead of looking up in jar file, it was looking in its cache directory.

Upvotes: 1

Related Questions