public List < DbMigration > getMigrationsSinceVersion ( int version ) { List < DbMigration > dbMigrations = new ArrayList <> ( ) ; migrationScripts . stream ( ) . filter ( script -> script . getVersion ( ) > version ) . forEach ( script -> { String content = loadScriptContent ( script ) ; dbMigrations . add ( new DbMigration ( script . getScriptName ( ) , script . getVersion ( ) , content ) ) ; } ) ; return dbMigrations ; }
Returns all migrations starting from and excluding the given version . Usually you want to provide the version of the database here to get all migrations that need to be executed . In case there is no script with a newer version than the one given an empty list is returned .