Change Types
Common change types supported in Harness Database DevOps for schema and data management.
A Liquibase-compatible schema is composed of one or more Change Types. These are a structured instruction that defines particular database updates. Each changeset you write in YAML, XML, JSON, or SQL contains one or more change types. When Applying the change, Database DevOps translates these into the correct SQL statements for the target database platform.
Why Change Types Matter
Cross-Database Compatibility: You write a single change definition; Liquibase generates SQL for MySQL, PostgreSQL, Oracle, SQL Server, and more.
Clarity & Safety: Change types are declarative and easier to understand than raw SQL. They also help avoid mistakes with rollbacks.
Governance & Review: Each changeset with a defined change type can be tracked, versioned, and peer-reviewed like application code.
Automation-Friendly: Change types integrate smoothly into CI/CD pipelines, making database deployments repeatable and reliable.
Categories of Change Types
Harness Database DevOps supports a wide range of change types for managing schema and data evolution. The change types are grouped by Entity, Constraint, Data, Programmability, and Utility, along with their rollback behavior and examples.
1. Create Table Creates a new table with defined columns. By default, when rolled back the table is dropped.
- changeType: createTable
tableName: users
columns:
- name: id
type: int
constraints:
primaryKey: true
- name: name
type: varchar(255)Drop Table Removes an existing table. This change type has no automatic rollback; write a manual rollback block with a
createTablestatement if you need to restore the table.
- changeType: dropTable
tableName: usersAdd Column Adds new columns to a table. By default when rolled back, drops the added columns.
- changeType: addColumn
tableName: users
columns:
- name: email
type: varchar(255)Drop Column Removes a column from a table. This change type has no automatic rollback; write a manual rollback block with an
addColumnstatement if you need to restore the column.
Rename Column Renames a column in a table. When rolled back, renames it back.
Rename Table Renames a table. When rolled back, renames it back.
Create Index Creates an index to improve query performance. When rolled back, the index is dropped.
Drop Index Removes an existing index. This change type has no automatic rollback; write a manual rollback block with a
createIndexstatement if you need to restore the index.
Modify Data Type Changes the data type of an existing column. This change type has no automatic rollback; write a manual rollback block if you need to revert to the original type.
Depending on the database engine and table size, modifying a column’s data type may acquire locks or trigger a table rewrite. Consider phased rollouts for large production tables.
Add Auto Increment Configures an existing column as auto-incrementing so the database generates a new value on each insert. This change type has no automatic rollback; write a manual rollback block if you need to reverse it.
Add Lookup Table Creates a new lookup table populated with the distinct values from a source column, then adds a foreign key on the source table pointing to the new lookup table. The source column is not dropped. When rolled back, the lookup table and foreign key are removed.
Merge Columns Concatenates the values of two existing columns into a new combined column, then drops both source columns. This change type has no automatic rollback, so back up the source data before you run it.
Set Column Remarks Adds a descriptive comment to a column, stored in the database catalog. This change type has no automatic rollback; write a manual rollback block if you need to clear the remark.
Set Table Remarks Adds a descriptive comment to a table, stored in the database catalog. This change type has no automatic rollback; write a manual rollback block if you need to clear the remark.
Add Primary Key Adds a primary key constraint. When rolled back, drops the primary key.
Drop Primary Key Removes a primary key. This change type has no automatic rollback; write a manual rollback block with an
addPrimaryKeystatement if you need to restore it.
Add Foreign Key Defines a foreign key relationship. When rolled back, the foreign key is dropped.
Drop Foreign Key Removes a foreign key. This change type has no automatic rollback; write a manual rollback block with an
addForeignKeyConstraintstatement if you need to restore it.
Add Unique Constraint Enforces uniqueness on a column. When rolled back, the constraint is dropped.
Drop Unique Constraint Removes a uniqueness constraint. This change type has no automatic rollback; write a manual rollback block with an
addUniqueConstraintstatement if you need to restore it.
Add Not Null Constraint Marks a column as NOT NULL. When rolled back, the NOT NULL constraint is removed.
Drop Not Null Constraint Removes a NOT NULL constraint. When rolled back, the NOT NULL constraint is restored.
Add Check Constraint Adds a constraint to validate data at the database level. When rolled back, the constraint is dropped.
Drop Check Constraint Removes an existing CHECK constraint. This change type has no automatic rollback; write a manual rollback block with an
addCheckConstraintstatement if you need to restore it.
Add Default Value Sets a default value for a column. When rolled back, the default value is removed.
Drop Default Value Removes a column’s default value. This change type has no automatic rollback; write a manual rollback block with an
addDefaultValuestatement if you need to restore it.
Drop All Foreign Key Constraints Removes all foreign key constraints from a table in a single operation. Liquibase cannot roll this change back because it does not record which constraints it dropped. Recreate them individually with
addForeignKeyConstraintif you need to revert.
Load Data Loads rows from a CSV file into an existing table using INSERT statements. This change type has no automatic rollback; write a manual rollback block if you need to reverse it. NULL in CSV becomes a database NULL, not the string "NULL".
Insert Inserts rows into a table. This change type has no automatic rollback; write a manual rollback block with a
deletestatement if you need to reverse it.
Update Updates rows in a table. This change type has no automatic rollback; write a manual rollback block if you need to revert the changes.
Delete Deletes rows from a table. This change type has no automatic rollback; write a manual rollback block with an
insertstatement if you need to restore the rows.
Load Update Data Upserts reference data from a CSV file: updates the row if it exists, inserts it otherwise. This change type has no automatic rollback; write a manual rollback block if you need to reverse it.
Execute SQL Executes database-specific SQL when a declarative change type is not available. This change type has no automatic rollback; write a manual rollback block if you need to reverse it.
SQL File Executes SQL from an external file. Useful for complex scripts that are easier to maintain separately. This change type has no automatic rollback; write a manual rollback block if you need to reverse it.
Create View Creates a database view. When rolled back, the view is dropped.
Drop View Removes an existing view. This change type has no automatic rollback; write a manual rollback block with a
createViewstatement if you need to restore it.
Rename View Renames a view. When rolled back, renames it back.
Create Procedure Creates a stored procedure. This change type has no automatic rollback; write a manual rollback block if you need to reverse it.
Drop Procedure Removes a stored procedure. This change type has no automatic rollback; write a manual rollback block with a
createProcedurestatement if you need to restore it.
Create Sequence Creates a database sequence for generating ordered numeric values. When rolled back, the sequence is dropped.
Alter Sequence Modifies properties of an existing sequence. This change type has no automatic rollback; write a manual rollback block if you need to restore prior sequence properties.
Drop Sequence Removes a sequence. This change type has no automatic rollback; write a manual rollback block with a
createSequencestatement if you need to restore it.
Rename Sequence Renames a sequence. When rolled back, the sequence is renamed back to the original name.
Stop Fails the deployment at this point with an error message. This aborts the Apply step rather than pausing it; it is not an approval gate. To require manual sign-off before a deployment proceeds, use a Harness approval stage in your pipeline instead.
Output Emits a message to the Liquibase log or console during deployment. Does not modify the database.
Change Types vs Raw SQL
The table below compares the advantages of using change types versus writing raw SQL for database changes:
Portability
Works across multiple databases (Liquibase translates automatically)
Vendor-specific, different SQL databases have minor SQL syntax differences that may cause failure on different platforms.
Readability
Declarative and self-explanatory
Requires SQL expertise to interpret
Rollback
Built-in rollback support for most change types
Must be manually written and tested
Governance
Easier to version, review, and audit
Harder to maintain compliance and history
Flexibility
Covers most schema, data, and constraint changes
Needed for complex, vendor-specific features
Always prefer Change Types for common operations; fall back to raw SQL only when absolutely necessary.
Conclusion
Change types are the building blocks of database changes in Harness Database DevOps. They provide a clear, portable, and automation-friendly way to manage schema and data evolution across diverse database platforms. By leveraging change types, teams can ensure safer deployments, easier rollbacks, and better collaboration in their database development workflows. For complex scenarios not covered by change types, raw SQL can be used, but it should be minimized to maintain the benefits of using change types.
Next steps
Now that you understand change types, you can start authoring and deploying database changes with Harness Database DevOps.
Go to Build a changelog to write your first changelog using change types.
Go to Changesets to understand how change types are grouped and tracked.
Go to Automatic and custom rollback to learn how rollback behavior works for each change type.
Go to Supported platforms to check which change types are available for your target database.
Last updated
Was this helpful?