Sanity Library Reference Docs
    Preparing search index...

    Interface Migration<Def>

    Main interface for a content migration definition https://www.sanity.io/docs/schema-and-content-migrations#af2be129ccd6

    interface Migration<Def extends MigrateDefinition = MigrateDefinition> {
        documentTypes?: string[];
        filter?: string;
        migrate: Def;
        title: string;
    }

    Type Parameters

    Index

    Properties

    documentTypes?: string[]

    An array of document types to run the content migration on. If you don’t define this, the migration type will target all document types. Note: This reflects the document types your migration will be based on, not necessarily the documents you will modify.

    filter?: string

    A simple GROQ-filter (doesn’t support joins) for documents you want to run the content migration on. Note: instead of adding _type == 'yourType' to the filter, it's better to add its _type to documentTypes. Note: documentTypes and filter are combined with AND. This means a document will only be included in the migration if its _type matches any of the provided documentTypes AND it also matches the filter (if provided).

    migrate: Def

    An object of named helper functions corresponding to the primary schema type of the content you want to migrate. You can also run these functions as async and return the migration instructions as promises if you need to fetch data from elsewhere. If you want more control, migrate can also be an async iterable function that yields mutations or transactions. NodeMigration AsyncIterableMigration

    title: string

    A reader-friendly description of what the content migration does