For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configure Author DB Change

Step-by-step guide to enable LLM-powered change authoring in Harness and automatically open a pull request against a target Git repository.

This guide explains how to enable an LLM-driven change authoring workflow in Harness Database DevOps that generates migration artifacts (e.g., Liquibase changesets or SQL migration scripts), commits them to a temporary branch, and opens a Pull Request (PR) against a target Git branch for review and CI validation. The workflow preserves GitOps principles (auditability, review gates, CI checks) while accelerating authoring through LLM assistance.

Prerequisites

Before configuring LLM change authoring, ensure you have the following:

  • An active Harness account with Database DevOps enabled.

  • Access to a Git repository where database migration artifacts will be stored.

Configure Harness AI and DB Schema

Step 1: Enable Harness AI

  1. Log in to your Harness account.

  2. Navigate to Account Settings > Default Settings > Harness AI.

  3. Toggle the Harness AI switch to enable it for your account.

  4. Then click on Database DevOps and in LLM Authoring Test and Commit Pipeline field point to the LLM pipeline identifier, e.g., dbops_llm_test_preview which we will create in the next step.

Step 2: Create a pipeline with Author DB Change steps

  1. Go to the Pipelines section in Harness.

  2. Click on Create Pipeline, and click on Add Stage and select the Custom Stage

  3. Provide the desired name for your pipeline, and click on Add. (Make sure that the pipeline identifier is same as mentioned in LLM pipeline identifier in step 1)

  4. Create a New Step Group.

  5. Click on Add Step and select the DB Test and Preview step from the list of available steps.

Database DevOps Test and Preview

IMPORTANT

Leave schema and instance set as runtime input, i.e., <+input>, as these will be provided by the LLM change authoring.

  1. Click on Add Step again and select the Run Step from the list of available steps.

  2. Configure the Run step to run the following script to create a Pull Request in your Git repository with the generated migration artifacts.

  • First, add a pipeline variable (or step input) named $REPO_TYPE with allowed values: "github", "bitbucket", "harness". (This variable will determine the Git provider and API used for creating the Pull Request).

  • In the Run step configuration, set the image to prontotools/alpine-git-curl:latest which has git and curl installed, and set the shell to Sh.

  • Then use the following unified script, replacing the common placeholders with your actual values:

Setup the following environment variables in the Run step configuration, ensuring that sensitive values like github, bitbucket, and harness_api_token are stored securely in Harness secrets and referenced appropriately:

Variable Name

Type

Description

Example

REPO_TYPE

String

Target Git provider

github, bitbucket, harness

USER_EMAIL

String

Git commit author email

USER_NAME

String

Git commit author name

Jane Doe

USERNAME

String

Git provider username (GitHub/Bitbucket only)

janedoe

REPO

String

Repository name

my-database-repo

WORKSPACE

String

Workspace slug (Bitbucket only)

mycompany

ORG_ID

String

Organization identifier (Harness Code only)

default

PROJECT_ID

String

Project identifier (Harness Code only)

my_project

ACCOUNT_ID

String

Account identifier (Harness Code only)

abc123

HARNESS_CODE_NAME

String

Harness Code username (Harness Code only)

code_token_toewv

Database DevOps LLM Authoring Environment Variables

NOTE

If the target Git provider is Harness Code, ensure that the REPO_TYPE is set to harness.

You can also set USER_NAME and USER_EMAIL to the user who started the pipeline via expression: <+pipeline.startingUser.email> and <+pipeline.startingUser.name> to automatically attribute the commit and PR to the user who initiated the change authoring process.

Database DevOps Pipeline Trigger

Step 3: Author your first DB change

  1. Select your Database DevOps project from the Harness dashboard.

  2. Navigate to your desired Database Schema.

  3. Click on Edit Schema to open the schema details page and select the Primary DB Instance (Optional) from the dropdown.

  4. Click on the Author DB Change tab.

  5. In the Author DB Change chat window, mention the changes you want to make to the database schema. For example, you can type:

    Database DevOps LLM Authoring
  6. Once satisfied with the changes, Click on the Test and Preview button. The LLM will process your request and generate the appropriate migration artifacts (e.g., changesets or SQL scripts).

  7. You can monitor the pipeline execution status via the Chat Window. Once the pipeline completes successfully, a Pull Request will be created in your Git repository with the generated migration artifacts since the pipeline is configured to create a Pull Request.

Open PR with the changes

Next steps

Last updated

Was this helpful?