schema diff
Compares two schemas and reports the blocks, folders, and datasources that --to adds, changes, or removes compared to --from. Each side is either a space ID or a local entry file. Run it before schema push to preview a push, or in CI to detect changes made to a space in the Storyblok UI.
Prerequisites
Section titled “Prerequisites”- To compare a space, log in with
storyblok login. - To compare a local schema, an entry file that exports schema definitions authored with
@storyblok/schema.
storyblok schema diff --from <space-id|entry-file> --to <space-id|entry-file> [flags]| Flag | Type | Description |
|---|---|---|
--from |
string | Required. The base schema: a space ID or a path to a schema entry file. |
--to |
string | Required. The target schema: a space ID or a path to a schema entry file. |
--exit-code |
boolean | Optional. Exit with 1 when the schemas differ and 2 on error. Refer to Exit codes. |
Examples
Section titled “Examples”# Preview what pushing the local schema changes in a spacestoryblok schema diff --from 123456 --to src/schema/schema.ts# Fail a CI job when the space drifted from the local schemastoryblok schema diff --from 123456 --to src/schema/schema.ts --exit-codeExit codes
Section titled “Exit codes”By default, the command exits with 0 whether or not the schemas differ. With --exit-code, the exit code reports the result, like git diff --exit-code:
| Exit code | Meaning |
|---|---|
0 |
The schemas match. |
1 |
The schemas differ. |
2 |
The command failed. |
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