@Override
    public boolean configure(FeatureContext context) {
        generateMigrationId();
        Map<String, Object> properties = context.getConfiguration().getProperties();
        List<Migration> migrations = Lists.newArrayList();
        DataSourceManager.getDataSourceNames()
                .stream()
                .filter(dbName -> !"false".equals(properties.get("db." + dbName + ".migration.enabled")))
                .forEach(dbName -> {
                    Flyway flyway = new Flyway();
                    flyway.setDataSource(DataSourceManager.getDataSource(dbName));
                    flyway.setBaselineOnMigrate(true);
                    bindFlyway(dbName, flyway);
                    Migration migration = locator.getService(Migration.class, dbName);
                    migrations.add(migration);
                    flyway.setResolvers(new DatabaseMigrationResolver(migration));
                });

        if (!migrations.isEmpty()) {
            context.register(MigrationFilter.class);
        }

        context.register(MigrationResource.class);

        if (!mode.isDev()) {
            for (Migration migration : migrations) {
                if (migration.hasChanged()) {
                    logger.warn(Messages.get("warn.app.database.migration", "@db/migration/" + MIGRATION_ID));
                    break;
                }
            }
        }

        return true;
    }
@ Override public boolean configure ( FeatureContext context ) { generateMigrationId ( ) ; Map < String , Object > properties = context . getConfiguration ( ) . getProperties ( ) ; List < Migration > migrations = Lists . newArrayList ( ) ; DataSourceManager . getDataSourceNames ( ) . stream ( ) . filter ( dbName -> ! "false" . equals ( properties . get ( "db." + dbName + ".migration.enabled" ) ) ) . forEach ( dbName -> { Flyway flyway = new Flyway ( ) ; flyway . setDataSource ( DataSourceManager . getDataSource ( dbName ) ) ; flyway . setBaselineOnMigrate ( true ) ; bindFlyway ( dbName , flyway ) ; Migration migration = locator . getService ( Migration . class , dbName ) ; migrations . add ( migration ) ; flyway . setResolvers ( new DatabaseMigrationResolver ( migration ) ) ; } ) ; if ( ! migrations . isEmpty ( ) ) { context . register ( MigrationFilter . class ) ; } context . register ( MigrationResource . class ) ; if ( ! mode . isDev ( ) ) { for ( Migration migration : migrations ) { if ( migration . hasChanged ( ) ) { logger . warn ( Messages . get ( "warn.app.database.migration" , "@db/migration/" + MIGRATION_ID ) ) ; break ; } } } return true ; }
{@inheritDoc}