Example Changelogs: YAML Format
Liquibase supports YAML as a format for storing your Changelog files.
Requirements
To use YAML-based changelogs, you must include snakeyaml-<version>.jar in your classpath.
Limitations
None
Example
This example changelog contains changesets that:
- Create a new
person
table with columnsid
,firstname
,lastname
, andstate
- Add a new
username
column to theperson
table - Create a lookup table
state
using data fromperson
The example precondition requires the user making the deployment to be liquibase
.
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)