Skip to main content

Function: applyMigration()

applyMigration<T, S>(models, migration): MigrationResult<T & S>

Defined in: defineMigration.ts:280

Lower-level entry point that returns the merged models plus the per-field metadata collected during the migration callback: UpgradeFieldOptions from addField(name, type, options) and deprecations from deprecateField(name). Used by addSchemaUpdate to fold sugar-form upgrades into a VersionedSchema's migrations map and deprecations into its deprecations map.

Each RecordBuilderImpl.build() attaches its collected upgrade options and deprecations to the produced RecordDef via two non-enumerable carrier properties; this function walks the merged result, extracts both keyed by the user's chosen output key (so renames are handled), and strips the carriers so the returned RecordDefs are structurally clean.

Type Parameters​

T​

T extends ModelDefs

S​

S extends ModelDefs

Parameters​

models​

T

migration​

(schema) => S

Returns​

MigrationResult<T & S>