Here's an example of a migration script using the utility function migrateIconName
to migrate the icon name using the default options.outputFormat
to using options.outputFormat: 'react'
.
If you want to migrate from default
to react
, pass react
as the third argument. If you want to do it the other way around, simply skip passing a third argument.
IMPORTANT! Be sure to create a backup of your dataset before running migrations, so you can roll back in case something goes wrong. Before you run any migrations, you should know what you are doing. You can read more on migrations here.
In this example I'm migrating an object field icon
that is a field of document type icons
. The structure most likely looks different in your project, so tweak the script and use with caution.
import { createClient } from '@sanity/client'
import { migrateIconName } from 'sanity-plugin-icon-picker'