Skip to content

migrations run

Executes migration files for specific components in a Storyblok space, updating stories that use those components based on the defined migrations. Generates a component-specific snapshot of the space before applying the migrations to allow for rollback if needed.

  • Migration files generated by migrations generate and updated with the desired changes must be present in the expected directory.
Terminal window
storyblok migrations run [arguments] [flags]
Argument Type Description
Component name string Optional. The technical name of a single component to run the migration for. If omitted, all migrations found in the specified path are run in the space.
Flag Type Description
--space, -s integer Required. The ID of the Storyblok space to run migrations for.
--filter, -fi string Optional. Glob pattern to filter stories by their component name (e.g., hero* will match all stories starting with hero).
--dry-run, -d boolean Optional. Preview changes without applying them.
--query, -q string Optional. Filter stories using query parameters.
--starts-with, -sw string Optional. A path prefix to filter stories to migrate.
--publish string Optional. Specify a publication mode: all (publish all stories), published (only publish stories that were already published), or published-with-changes (only publish stories that have unpublished changes).
--path, -p string Optional. Specify a custom path for migration files. Defaults to .storyblok/migrations/<space-id>.

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

Terminal window
# Run migration for the "hero-section" component in the specified space
storyblok migrations run hero-section
# Run all migrations in the specified space, filtering by component name and previewing changes without applying them
storyblok migrations run --filter "hero-*" --dry-run
# Run all migrations in the specified space, filtering by query and publishing stories that were already published
storyblok migrations run --publish published --query "[highlighted][in]=true"

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.