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.
Prerequisites
Section titled “Prerequisites”- Migration files generated by
migrations generateand updated with the desired changes must be present in the expected directory.
storyblok migrations run [arguments] [flags]Arguments
Section titled “Arguments”| 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>. |
Examples
Section titled “Examples”The following examples assume that a space has been defined in a configuration file.
# Run migration for the "hero-section" component in the specified spacestoryblok migrations run hero-section# Run all migrations in the specified space, filtering by component name and previewing changes without applying themstoryblok migrations run --filter "hero-*" --dry-run# Run all migrations in the specified space, filtering by query and publishing stories that were already publishedstoryblok migrations run --publish published --query "[highlighted][in]=true"Was 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