Skip to content

migrations generate

Creates migration files for specific components of a Storyblok space. Migrations are useful for making changes to existing stories in a Storyblok space, such as updating component structures or content.

The command will recursively generate a folder structure and migration file for the specified component:

.storyblok/
└── migrations/
└── <space-id>/
└── <component-name>[.<suffix>].js

The generated migration file contains a template function with examples for common transformations. The function receives a block parameter that contains the components data. The function should return the updated block.

Terminal window
storyblok migrations generate <component-name> --space <source-space-id> [--suffix <suffix>]
Argument Type Description
Component name string Required. The technical name of a single component to generate a migration for.
Flag Type Description
--space integer Required. The ID of the Storyblok space that contains the component to generate a migration for.
--path string Optional. Specify a custom path for migration files. Defaults to .storyblok/migrations/<space-id>.
--suffix string Optional. Specify a custom suffix for migration files.

The following examples assume that a space has been defined in a configuration file.

Terminal window
# Generate a migration for the "hero-section" component in the specified space
storyblok migrations generate hero-section
# Generate a migration for the "hero-section" component in the specified space, saving with a custom suffix
storyblok migrations generate hero-section --suffix dev

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.