> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/database-devops/use-db-devops/changelogs-and-schema-changes/liquibase/schema-synchronization.md).

# Changelog Sync with Database DevOps

Learn how to use the Liquibase changelog-sync command with Harness Database DevOps to baseline database environments and align changelog state without deploying changes.

Harness Database DevOps supports the use of Liquibase’s `changelog-sync` command to help teams baseline database environments and align changelog state without deploying changes to the database. This is particularly useful when introducing Liquibase to existing databases or when multiple environments have intentionally divergent objects.

### What is schema sync?

The Schema sync operation, executed via the `changelog-sync` command, marks all changesets in a specified changelog as executed in the target database without actually applying any of the changes defined in those changesets. No database objects are created, modified, or dropped.

### Prerequisites

Before running `changelog-sync`, ensure the following:

* A Harness account with access to the Database DevOps module
* A database instance and schema configured in Harness
* A valid liquibase compatible changelog committed to your Git repository

### Run changelog sync in a Harness pipeline

Follow these steps to run a changelog sync in your pipeline.

1. Navigate to Pipelines in the Database DevOps module.
2. Create existing pipeline and Add a **Custom Stage**.
3. Create a **Step Group** and enable Container-based execution.
4. Select the **Liquibase Command** step.
5. Configure the step:
   * **Select DB Schema**: Select the database schema.
   * **Select DB Instance**: Select the target database instance.
   * **Command**: `changelog-sync` to mark all changesets as executed.
6. Save and run the pipeline.

### When to use changelog sync

The `changelog-sync` command is commonly used in the following scenarios:

#### Baseline a new environment

When onboarding an existing database into Liquibase or Harness Database DevOps, you may already have schema objects present that are defined in your changelog. Running `changelog-sync` allows you to baseline the database without reapplying those changes.

#### Align environments with intentional differences

For example:

* A **DEV** environment contains development-only tables or objects.
* A new **TEST** environment should not include those DEV-only objects.
* Both environments must still share the same changelog.

In this case, running `changelog-sync` on TEST marks the DEV-only changesets as executed, preventing them from being deployed while keeping the changelog aligned.

#### Prevent failures from manually created objects

If a database object was created manually outside of Liquibase, subsequent Liquibase updates may fail when attempting to recreate that object. By marking the corresponding changeset as executed using `changelog-sync`, you prevent update failures while maintaining changelog consistency.

### Next steps

* Go to [Build a changelog](/database-devops/use-db-devops/changelogs-and-schema-changes/liquibase/build-a-changelog.md) to structure your changelog files for use with changelog sync.
* Go to [Failure strategies in Database DevOps](/database-devops/use-db-devops/deployment-pipeline-configuration/rollback-and-failure-strategies/failure-strategies.md) to configure how your pipeline handles changeset failures.

{% @harness-feedback/feedback %}
