createMigrationSequence
See source codeCreates a migration sequence that defines how to transform data as your schema evolves.
A migration sequence contains a series of migrations that are applied in order to transform data from older versions to newer versions. Each migration is identified by a unique ID and can operate at either the record level (transforming individual records) or store level (transforming the entire store structure).
See the migration guide for more info on how to use this API.
function createMigrationSequence({
sequence,
sequenceId,
retroactive,
}: {
retroactive?: boolean
sequence: Array<Migration | StandaloneDependsOn>
sequenceId: string
}): MigrationSequence
Example
const bookMigrations = createMigrationSequence({
sequenceId: 'com.myapp.book',
sequence: [
{
id: 'com.myapp.book/1',
scope: 'record',
up: (record) => ({ ...record, newField: 'default' }),
},
],
})
Parameters
Name | Description |
---|---|
|
|
Returns
A validated migration sequence that can be included in a store schema
Prev
createMigrationIdsNext
createRecordType