CLI reference
Migration
Create, list, and run content migrations
Available commands
usage: sanity migration [--default] [-v|--version] [-d|--debug] [-h|--help] <command> [<args>]
Commands:
create Create a new content migration within your project
list List available migrations
run Run a migration against a dataset
See 'sanity help migration <command>' for specific information on a subcommand.
Creating a content migration
usage: sanity migration create [TITLE]
Create a new content migration within your project
Create a new migration within your project
Examples:
# Create a new migration, you will be prompted to provide a type
sanity migration create
# Create a new migration, specifying the title
sanity migration create "Rename field from location to address"
Listing content migrations
usage: sanity migration list [NAME]
List available migrations
Running content migrations
usage: sanity migration run ID
Run a migration against a dataset
Options
--dry-run <boolean> Whether or not to dry run the migration. Default to true, to actually run the migration, pass --no-dry-run
--concurrency <concurrent> How many mutation requests to run in parallel. Must be between 1 and 10. Default: 6.
--no-progress Don't output progress. Useful if you want to debug your migration script and only see the output of console.log() statements.
--dataset <dataset> Dataset to migrate. Defaults to the dataset configured in your Sanity CLI config.
--project <project id> Project ID of the dataset to migrate. Defaults to the projectId configured in your Sanity CLI config.
--no-confirm Skip the confirmation prompt before running the migration. Make sure you know what you're doing before using this flag.
Examples
# dry run the migration
sanity migration run <id>
# execute the migration against a dataset
sanity migration run <id> --no-dry-run --project xyz --dataset staging
Was this page helpful?