Function: registerMigration()
registerMigration(
migration):void
Defined in: packages/core/src/saves/migrations/registry.ts:38
Registers a migration function for moving from one version to another.
Migrations should be registered during game initialization, typically in
your game's entry point after calling Game.init().
Parameters
migration
The migration definition
Returns
void
Throws
Error if a migration with the same from->to path already exists
Example
registerMigration({
from: "1.0.0",
to: "1.1.0",
description: "Added player inventory",
migrate: (data) => ({
...data,
player: { ...data.player, inventory: [] }
})
});