Skip to content

Updating Schema

After you have updated your schema TypeScript files locally, you must publish it to Stately Cloud before you can use it - until then, the associated Stores will not know about your changes.

Using the CLI, stately schema put publishes a new version of your schema. This will also run your schema TypeScript files. For this to run, you need to have NodeJS installed, and have installed the dependencies for your schema package with npm install.

The first positional argument is the path to your schema’s index file (you can have schema in as many TypeScript files as you want as long as there’s a single file that exports everything). You can find your Schema ID in the Console and in the output of stately whoami.

stately schema put --schema-id <your schema ID> \
--message "A schema update!" path/to/schema.ts

Backwards Compatibility Check

stately schema put will fail if you are making a backwards-incompatible change to your schema. We’re intentionally conservative right now about what counts as a backwards compatible change. You can add the --allow-backwards-incompatible argument to override this, but realize you’re taking the validity of your stored data into your own hands at that point. Eventually we will remove the --allow-backwards-incompatible option when Elastic Schema can handle all types of changes—in the meantime, it is sometimes necessary to override the backwards compatibility check when you know it’s safe.