Skip to content

Add support for STEP in clickhouse rake tasks

What does this MR do and why?

This MR adds support for specifying the STEP environment variable, in the same way as the equivalent Rails rake tasks. The immediate consequence is that bin/rake clickhouse:rollback will no longer roll back all migrations, since STEP defaults to 1 for rollbacks.

Part of #428124 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Ensure all the migrations are up:

    rake gitlab:clickhouse:migrate
  2. Migrate down to a specific version:

    rake gitlab:clickhouse:rollback VERSION=20230724064918

    this should roll back 3 migrations:

    image

  3. Perform a rollback:

    rake gitlab:clickhouse:rollback

    this should roll back the last active migration:

    image

  4. Migrate down a few steps:

    rake gitlab:clickhouse:rollback STEP=2

    this should roll back 20230724064832 and 20230719101806:

    image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports