Feature repository specific data migration (#1526)

This adds a new migration mechanism for repository data. Instead of using UpdateSteps for all data migrations, repository data shall from now on be implemented with RepositoryUpdateSteps. The general logic stays the same. Executed updates are stored with the repository. Doing this, we can now execute updates on imported repositories without touching other data. This way we can import repositories even though they were exported with older versions of SCM-Manager or a plugin.
This commit is contained in:
René Pfeuffer
2021-02-10 08:12:48 +01:00
committed by GitHub
parent 7c50fd935c
commit e0d2630a08
24 changed files with 743 additions and 146 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.store;
import java.util.HashMap;
@@ -38,10 +38,13 @@ public class InMemoryConfigurationEntryStoreFactory implements ConfigurationEntr
@Override
public <T> ConfigurationEntryStore<T> getStore(TypedStoreParameters<T> storeParameters) {
String name = storeParameters.getName();
if (storeParameters.getRepositoryId() != null) {
name = name + "-" + storeParameters.getRepositoryId();
}
return get(name);
}
public <T> InMemoryConfigurationEntryStore<T> get(String name) {
return stores.computeIfAbsent(name, x -> new InMemoryConfigurationEntryStore());
return stores.computeIfAbsent(name, x -> new InMemoryConfigurationEntryStore<T>());
}
}