Public function

Signature
function defineMigrations<
  FirstVersion extends EMPTY_SYMBOL | number = EMPTY_SYMBOL,
  CurrentVersion extends EMPTY_SYMBOL | Exclude<number, 0> = EMPTY_SYMBOL,
>(opts: {
  firstVersion?: CurrentVersion extends number ? FirstVersion : never
  currentVersion?: CurrentVersion
  migrators?: CurrentVersion extends number
    ? FirstVersion extends number
      ? CurrentVersion extends FirstVersion
        ? {
            [version in Exclude<Range<1, CurrentVersion>, 0>]: Migration
          }
        : {
            [version in Exclude<
              Range<FirstVersion, CurrentVersion>,
              FirstVersion
            >]: Migration
          }
      : {
          [version in Exclude<Range<1, CurrentVersion>, 0>]: Migration
        }
    : never
  subTypeKey?: string
  subTypeMigrations?: Record<string, BaseMigrationsInfo>
}): Migrations
Parameters
NameDescription

opts

{
  firstVersion?: CurrentVersion extends number
    ? FirstVersion
    : never
  currentVersion?: CurrentVersion
  migrators?: CurrentVersion extends number
    ? FirstVersion extends number
      ? CurrentVersion extends FirstVersion
        ? {
            [version in Exclude<
              Range<1, CurrentVersion>,
              0
            >]: Migration
          }
        : {
            [version in Exclude<
              Range<FirstVersion, CurrentVersion>,
              FirstVersion
            >]: Migration
          }
      : {
          [version in Exclude<
            Range<1, CurrentVersion>,
            0
          >]: Migration
        }
    : never
  subTypeKey?: string
  subTypeMigrations?: Record<string, BaseMigrationsInfo>
}
Returns
Migrations
References

Migration, Migrations

Source

packages/store/src/lib/migrate.ts

createRecordTypedevFreeze