Skip to main content

Interface: UpgradeFieldOptions<TOld>

Defined in: defineMigration.ts:50

Upgrade options for a field added in this version. Supplied as the third argument to addField; surfaced by applyMigration as part of MigrationResult.upgrades. Declares the structural dependency (derivedFrom) the runtime lens uses to decide when to invoke the upgrade function. The function itself — derived or constant — is supplied at boot via the generated DocumentModel(...) factory's UpgradeFns parameter.

Type Parameters​

TOld​

TOld extends Record<string, unknown>

Properties​

derivedFrom​

readonly derivedFrom: readonly keyof TOld & string[]

Defined in: defineMigration.ts:56

The existing fields this new field is derived from. The runtime read lens uses this to know when to back-fill the field for records written by an older version; the app supplies the actual upgrade function at boot.