JSON changelog example
Last updated: September 2, 2025
Liquibase supports JSON as a format for storing your Changelog files.
Uses
When using a JSON-based changelog file, you need to choose one of the following ways to audit your database and execute changes:
Pass it as an argument in the command line during runtime:
liquibase update --changelog-file=example-changelog.jsonSpecify it in the Liquibase properties file:
changelog-file: ../example-changelog.json
You can also include other related properties in the properties file, such as the searchPath, which specifies the directories and .jar files to search for changelog files. If you have multiple files, they can be separated with commas.
Note: For more information, see Create and Configure a liquibase.properties File.
Example
This example changelog contains changesets that:
Create a new
persontable with columnsid,firstname,lastname, andstateAdd a new
usernamecolumn to thepersontableCreate a lookup table
stateusing data fromperson
The example precondition requires the user deploying the change to be liquibase.
Precondition example
{
"databaseChangeLog": [
{
"preConditions": [
{
"runningAs": {
"username": "liquibase"
}
}
]
},
{
"changeSet": {
"id": "1",
"author": "nvoxland",
"changes": [
{
"createTable": {
"tableName": "person",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primaryKey": true,
"nullable": false
}
}
},
{
"column": {
"name": "firstname",
"type": "varchar(50)"
}
},
{
"column": {
"name": "lastname",
"type": "varchar(50)",
"constraints": {
"nullable": false
}
}
},
{
"column": {
"name": "state",
"type": "char(2)"
}
}
]
}
}
]
}
},
{
"changeSet": {
"id": "2",
"author": "nvoxland",
"changes": [
{
"addColumn": {
"tableName": "person",
"columns": [
{
"column": {
"name": "username",
"type": "varchar(8)"
}
}
]
}
}
]
}
},
{
"changeSet": {
"id": "3",
"author": "nvoxland",
"changes": [
{
"addLookupTable": {
"existingTableName": "person",
"existingColumnName": "state",
"newTableName": "state",
"newColumnName": "id",
"newColumnDataType": "char(2)"
}
}
]
}
}
]
}