> 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/new-to-database-devops/onboarding-guide.md).

# Database DevOps Onboarding Guide

This onboarding guide accelerates your adoption journey by walking you through the essential setup steps from defining your database schemas to deploying versioned changes consistently across environments. Whether you use Liquibase or Flyway configurations, Harness orchestrates the full migration lifecycle within your Kubernetes infrastructure, ensuring predictable, auditable, and scalable database operations.

### Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

Before beginning the walkthroughs in this guide, ensure you have:

| Item                 | Details / Link                                                                                                                                                                                                |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Harness account      | Database DevOps License (go to “[Subscription Overview and Management](/harness-ai/subscriptions-and-licenses/subscriptions.md#modules-with-no-direct-developer-tracking-consumption-entitlements)”)          |
| Kubernetes cluster   | Kubernetes Cluster ≥ v1.18, Harness Delegate installed ([Delegate setup guide](/harness-ai/use-harness-platform/delegates/delegate/install-delegates/overview.md))                                            |
| Database credentials | JDBC‑compatible database; user with DDL/DML privileges. (Go to “[JDBC connection strings](/database-devops/setup-db-devops/jdbc-connection-string/set-up-connectors.md) to review connection string formats”) |

### Set up Database DevOps with Liquibase and Flyway <a href="#set-up-database-devops-with-liquibase-and-flyway" id="set-up-database-devops-with-liquibase-and-flyway"></a>

Harness supports both Liquibase Compatible and Flyway Compatible configurations, but the setup varies based on your preferred workflow. Before configuring your DB Schema, ensure your repository follows the correct structure and that your migration files adhere to the chosen framework’s conventions.

{% hint style="info" %}
**NOTE**

If you already use Liquibase or Flyway, you can skip to the section [Configuring Your DB Schema](#2-configure-your-database-schema).
{% endhint %}

#### 1. Prepare your migration framework (Flyway or Liquibase) <a href="#id-1-prepare-your-migration-framework-flyway-or-liquibase" id="id-1-prepare-your-migration-framework-flyway-or-liquibase"></a>

{% tabs %}
{% tab title="Liquibase Compatible" %}
If you are new to Liquibase, there are two main ways to create your initial changelog:

* Use existing SQL files: Recommended if you already manage your schema through SQL scripts.
* Generate a changelog: Auto-generate a changelog by diffing an existing database. Go to [Build a changelog](/database-devops/use-db-devops/changelogs-and-schema-changes/liquibase/build-a-changelog.md) to set up your changelog using either option.

1. Create a Git repository to store your DB schema files.
2. In the repository, create an `sql/` folder and add ordered `*.sql` files.
3. Add `changelog.yml` at the repository root:

```yml
databaseChangeLog:
  - includeAll:
      path: sql
```

Use semantic versioning in file names, such as `V1__init.sql` and `V2__add_table.sql`.

{% hint style="info" %}
**File naming**

Use semantic file names, such as `V1__init.sql` and `V2__add_table.sql`.
{% endhint %}

{% embed url="<https://app.tango.us/app/embed/6f6c9d9f-3791-44bd-bf4d-c91e96e61802?skipCover=false&defaultListView=false&skipBranding=true&makeViewOnly=true&hideAuthorAndDetails=true>" %}
Add New DB Liquibase Schema
{% endembed %}
{% endtab %}

{% tab title="Flyway Compatible" %}
If you are new to Flyway, start by creating migration files that follow Flyway's naming conventions and folder structure. Go to [Flyway Migration Files](/database-devops/use-db-devops/changelogs-and-schema-changes/flyway/flyway-migrations-file-structure.md) to understand naming conventions.

1. Create a Git repository containing your schema directory.
2. All migrations are stored under a folder such as "sql/migrations".
3. Files follow Flyway’s naming rules:
   * Versioned: "`V1__init.sql`", "`V2__add_table.sql`"
   * Undo (optional): "`U2__remove_table.sql`" This structure enables Flyway and Harness to consistently detect, version, and apply schema changes.

{% embed url="<https://app.tango.us/app/embed/5edf9a7b-7b7a-43f0-85df-6e927cd69993?skipCover=false&defaultListView=false&skipBranding=true&makeViewOnly=true&hideAuthorAndDetails=true>" %}
Add New DB Flyway Schema
{% endembed %}
{% endtab %}
{% endtabs %}

#### 2. Configure your database schema <a href="#id-2-configure-your-database-schema" id="id-2-configure-your-database-schema"></a>

The database schema defines a set of SQL changes that can be deployed to one or more database instances. Here is how we will configure it:

1. In the module picker, select **DB DevOps**.
2. In **DB Schemas**, click **Add New DB Schema**.
3. Select the migration type, either Liquibase Compatible or Flyway Compatible.
4. Enter the Git repository details where your schema files are stored:
   * **Git Connector** - The Git connector that has access to the repository containing your database schema files.
   * **Repository Name** - The name of the Git repository where your database schema files are stored.
5. Click **Next**, then enter the changelog file path for Liquibase or migrations folder path for Flyway:
   * For Liquibase: `changelog.yml`
   * For Flyway: `sql/migrations`
6. Click **Add DB Schema**.

{% hint style="info" %}
The primary database instance where the Liquibase changelog will be initially applied. (Once the Instance is created, you can add the primary instance by going to the DB Schema settings.)

If you use [Author DB Change](/database-devops/use-db-devops/create-database-updates/configure-llm-for-database-devops.md), this field is mandatory to set up the schema correctly.
{% endhint %}

{% hint style="info" %}
Go to [Harness Git connector settings](/harness-ai/use-harness-platform/connectors/code-repositories/ref-source-repo-provider/git-connector-settings-reference.md) to review connector options.
{% endhint %}

#### 3. Connect with database instance <a href="#id-3-connect-with-database-instance" id="id-3-connect-with-database-instance"></a>

Before we can deploy our Database Schema, we need to connect a database instance to which we can deploy it. Here is how:

{% embed url="<https://app.tango.us/app/embed/e1b78319-0170-40e2-935b-22eab05dcf3e?skipCover=false&defaultListView=false&skipBranding=true&makeViewOnly=true&hideAuthorAndDetails=true>" %}
Add New DB Instance
{% endembed %}

1. In **DB Instances**, click **Add New DB Instance**.
2. Select `main` or your environment branch.
3. Click **New JDBC Connector**, enter the name, JDBC URL, and credentials, then select the Harness [Overview](/harness-ai/use-harness-platform/delegates/delegate/delegate-concepts/delegate-overview.md). Click **Save and Finish**.
   * **Name** - A name to identify the database instance.
   * **JDBC URL** - The JDBC connection string for your database instance. Go to [JDBC connection strings](/database-devops/setup-db-devops/jdbc-connection-string/set-up-connectors.md) to review connection string formats.
   * **Username** - The username to connect to the database.
   * **Password** - The password for the database user.
   * **Delegate** - The Harness Delegate that will run the database operations.
4. Click **Add Database Instance**.

#### 4. Configure your deployment pipeline <a href="#id-4-configure-your-deployment-pipeline" id="id-4-configure-your-deployment-pipeline"></a>

A deployment pipeline deploys your database changes when it runs. In addition to deploying your database, it can also deploy application changes, and have other logic such as requiring a manual approval. Here are some steps on how to create a simple pipeline that deploys a schema change to a database instance anytime it changes in git:

1. In **Pipelines**, click **Create a Pipeline**.
2. Click **Add Stage**, then select **Custom stage**.
3. Select **Add step group**, then enable **Enable Containerized Stage**.
4. Select the Kubernetes cluster where the pipeline runs.
5. Click **Add Step**, then select **Apply Schema** under DB DevOps.
6. For the step name, enter "Deploy Database Schema". ![dbops-step-apply-schema](/files/gKIkDMEq7aNRcmDfj5us)
   * **Name**: Name of the step, by default the name is "DBSchemaApply\_1".
   * **Timeout**: The timeout limit is the maximum allowable time a stage or pipeline can run.
   * **Migration Type**: Liquibase Compatible or Flyway Compatible.
   * **Select DB Schema**: The DB Schema we created on Step 2.
   * **Select DB Instance**: The Instance we created on Step 3.
   * **Tag (Optional)**: You can add custom tags to each deployment. In case it is left empty, Harness will add the tag during the deployment.
7. Click **Apply Changes**, then save the pipeline.
8. Click **Run** and wait for the pipeline to complete.

{% tabs %}
{% tab title="Visual Overview" %}
![dbops-running](/files/V4bklCWTEphcJdTqtp9H)
{% endtab %}

{% tab title="YAML Overview" %}

```yml
pipeline:
  name: dbops-liquibase-pipeline
  identifier: dbopsliquibasepipeline
  projectIdentifier: DoNotDelete_AnimeshDBOPS
  orgIdentifier: Ng_Pipelines_K8s_Organisations
  tags: {}
  stages:
    - stage:
        name: dbops
        identifier: dbops
        description: "Deploy schema to DB instance using Liquibase"
        type: Custom
        spec:
          execution:
            steps:
              - stepGroup:
                  name: cs
                  identifier: cs
                  steps:
                    - step:
                        type: DBSchemaApply
                        name: DBSchemaApply_1
                        identifier: DBSchemaApply_1
                        spec:
                          connectorRef: account.harnessImage
                          migrationType: Liquibase
                          dbSchema: Liquibase
                          dbInstance: instance
                          tag: "123"
                        timeout: 10m
                    - step:
                        type: DBSchemaRollback
                        name: DBSchemaRollback_1
                        identifier: DBSchemaRollback_1
                        spec:
                          connectorRef: account.harnessImage
                          migrationType: Liquibase
                          dbSchema: Liquibase
                          dbInstance: instance
                          tag: v1.0.0
                        timeout: 10m
                  stepGroupInfra:
                    type: KubernetesDirect
                    spec:
                      connectorRef: dbops
            rollbackSteps: []
          serviceDependencies: []
        tags: {}
```

{% endtab %}
{% endtabs %}

### Conclusion <a href="#conclusion" id="conclusion"></a>

By completing the steps in this onboarding guide, you now have a fully operational Database DevOps workflow powered by Harness. Your schemas are version-controlled, your database instances are securely connected, and your pipelines are ready to execute repeatable, automated schema deployments using Liquibase or Flyway. This foundation sets the stage for enterprise-grade governance, faster release cycles, and improved developer productivity.

### Next steps <a href="#next-steps" id="next-steps"></a>

As you operationalize more environments, explore advanced capabilities to deepen your Database DevOps practice.

* Go to [Rollback automation](/database-devops/use-db-devops/deployment-pipeline-configuration/rollback-and-failure-strategies/rollback-for-database-schemas.md) to configure automated rollback for failed deployments.
* Go to [Author DB Change](/database-devops/use-db-devops/create-database-updates/configure-llm-for-database-devops.md) to use LLM-powered change authoring.
* Go to the [Database DevOps Troubleshooting Guide](/database-devops/troubleshooting-and-resources/troubleshooting-guide/troubleshooting.md) to resolve common setup and runtime errors.
