registerMigration

fun registerMigration(klass: KClass<*>, migration: ConfigMigration)

Registers a ConfigMigration for the given configuration type klass.

Migrations are applied automatically during load when the file's configVersion is lower than the target version defined in the data class. Multiple migrations can be registered and will be chained in order.

Example:

YamlConfigManager.registerMigration(MyConfig::class, MigrateV1ToV2)
YamlConfigManager.registerMigration(MyConfig::class, MigrateV2ToV3)

Since

1.0

Parameters

klass

The KClass of the configuration type the migration applies to.

migration

The migration step to register.

See also