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>].jsThe 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.
storyblok migrations generate <component-name> --space <source-space-id> [--suffix <suffix>]Arguments
Section titled “Arguments”| 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. |
Examples
Section titled “Examples”The following examples assume that a space has been defined in a configuration file.
# Generate a migration for the "hero-section" component in the specified spacestoryblok migrations generate hero-section# Generate a migration for the "hero-section" component in the specified space, saving with a custom suffixstoryblok migrations generate hero-section --suffix devWas this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community