Rollback DB Schema step
Last updated on
The Rollback DB Schema step reverts previously applied database changesets on a target DB instance as part of a Harness pipeline. It is typically added after an Apply DB Schema step as part of a failure strategy or a dedicated rollback stage.
Before you begin
- Applied migrations: Rollback requires changesets previously applied by an Apply DB Schema step. Nothing can be rolled back on a fresh instance with no applied changesets.
- Rollback scripts: Liquibase rollback requires that each changeset defines a rollback statement. Go to Automatic and Custom Rollback to understand when rollback scripts are required.
- Tag (for rollback by tag): The target tag must exist in
DATABASECHANGELOG. Go to Using Rollback Tags with Apply Schema to learn how tags are created.
Add the Rollback DB Schema step
- In Harness, go to Database DevOps and select your project.
- Open your pipeline and select the stage where you want to configure rollback.
- Add a Custom Stage with a step group.
- Inside the step group, Add Step and choose Rollback DB Schema.
- Configure the step parameters described below.
- Select Apply Changes, then save and run the pipeline.
Step parameters

- Name - Display name for the step. The step ID is derived from this name.
- Timeout - Maximum duration before the step times out. Default is
10m. - Container Registry - Select the container registry connector that Harness uses to pull the migration container.
- Migration Type - Select Liquibase or Flyway depending on your schema's migration tool.
- Select DB Schema - Choose the DB Schema associated with the instance you want to roll back.
- Select DB Instance - Choose the DB Instance where the rollback will be executed.
- Specify rollback target - Choose how to identify the rollback target: rollback to a specific tag, rollback by count, or rollback to a target version (Flyway). Go to Rollback for Database Schemas for details on each method.
Next steps
- Go to Apply DB Schema step to configure the apply step that precedes rollback.
- Go to Rollback for Database Schemas to understand rollback methods, automated rollback patterns, and failure strategies.
- Go to Automatic and Custom Rollback to learn how to write rollback scripts for complex changesets.