Skip to content

LiamMartens/sanity-migrations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanity Migrations

npm version

This is a simple migrations tool for Sanity

Usage

Creating a new migration

You can run the following command to generate a new migration. (this should be run inside a Sanity studio project) yarn sanity-migrations new my-migration

A new file will be created in the migrations directory in your studio. It will receive 2 arguments. The first one being a raw sanity client to use for your migration, the second one is an options object. At this time the only option is lastMigrationTs which contain a unix timestamp of the last run migration. (this is so you could query for documents after this time)

Running migrations

In your studio project you can run yarn sanity-migrations migrate to run the migrations.

The tool will respect your NODE_ENV and will use the appropriate dataset as defined in the env key of your sanity.json.

It will check the migration-log.json file to determine which migrations need to be executed. Before actually running the migrations you will be given an overview and asked whether to proceed or not.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages