Skip to content

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.

Terminal window
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.
Terminal window
# Preview what pushing the local schema changes in a space
storyblok schema diff --from 123456 --to src/schema/schema.ts
# Fail a CI job when the space drifted from the local schema
storyblok schema diff --from 123456 --to src/schema/schema.ts --exit-code

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?

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.