> 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/3.0/use-db-devops/changelogs-and-schema-changes/liquibase/schema-synchronization.md).

# Changelog Sync with Database DevOps

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? <a href="#what-is-schema-sync" id="what-is-schema-sync"></a>

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 <a href="#prerequisites" id="prerequisites"></a>

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 <a href="#run-changelog-sync-in-a-harness-pipeline" id="run-changelog-sync-in-a-harness-pipeline"></a>

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 <a href="#when-to-use-changelog-sync" id="when-to-use-changelog-sync"></a>

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

#### Baseline a new environment <a href="#baseline-a-new-environment" id="baseline-a-new-environment"></a>

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 <a href="#align-environments-with-intentional-differences" id="align-environments-with-intentional-differences"></a>

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 <a href="#prevent-failures-from-manually-created-objects" id="prevent-failures-from-manually-created-objects"></a>

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 <a href="#next-steps" id="next-steps"></a>

* Go to [Build a changelog](/database-devops/3.0/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/3.0/use-db-devops/deployment-pipeline-configuration/rollback-and-failure-strategies/failure-strategies.md) to configure how your pipeline handles changeset failures.
