migrate

fun migrate(rawMap: MutableMap<String, Any?>, currentVersion: Int, sourceFile: File? = null): MutableMap<String, Any?>

Migrates a raw configuration map from its detected version to currentVersion.

The file version is read from the configVersion entry in rawMap, defaulting to 1 if absent. If the file is already at or above currentVersion, the map is returned unmodified.

Before any transformations, a backup of sourceFile is created as <filename>.v<fileVersion>.bak if the backup does not already exist.

Return

The migrated map with configVersion set to currentVersion.

Since

1.0

Parameters

rawMap

The mutable raw YAML map to migrate.

currentVersion

The target schema version to migrate to.

sourceFile

Optional source file for creating backups. If null, no backup is made.

See also

Throws

If the migration chain has a gap (no migration found for a required version step).