Skip to content

Sample migration scripts for Kontent.ai CLI tool

License

Notifications You must be signed in to change notification settings

kontent-ai/migrations-boilerplate

Repository files navigation

Kontent.ai migrations examples

The Kontent.ai migrations boilerplate aims to provide a exemplary introduction in developing migrations using Kontent.ai data-ops. Migrations allow you to perform any operation supported by the Management API through smaller executable scripts. This repository showcases various migration scenarios, including the creation of different entities. Each migration also includes a rollback function to reverse the changes made by the migration.

Note

The migrations in this repository are written in TypeScript and must be transpiled before execution.

Quickstart

  1. Install required depencies
    npm ci
  2. Set up mandatory parameters for data-ops migrations:
    • Copy exampleParams.json and rename it to migrationsParams.json
    • Fill in the missing parameters for your environment.
  3. Inspect the migrations in the src folder.
  4. Examine prepared scripts in package.json.
  5. Try out the scripts
    • e.g. npm run migrate:all to run all of the migrations

Tip

You can add additional parameters using --. For example, to rollback next 5 migrations, use npm run migrate:next -- 5 -b.

Tip

You can view all parameters by using npm run data-ops -- migrations <command> --help