Skip to content

Instantly share code, notes, and snippets.

@nlinker
Created April 24, 2012 08:19
Show Gist options
  • Save nlinker/2477809 to your computer and use it in GitHub Desktop.
Save nlinker/2477809 to your computer and use it in GitHub Desktop.
Liquibase example
databaseChangeLog() {
changeSet(id: "my first changeset", author: "daniel") {
comment('A comment')
createTable(tableName: 'my_table') {
column(name: 'id', type: 'uuid', defaultValue: 'uuid_generate_v4()') {
constraints(primaryKey: true, nullable: false)
}
column(name: 'name', type: 'character varying(100)') {
constraints(nullable: false)
}
column(name: 'active', type: 'boolean') {
constraints(nullable: false)
}
}
createIndex(indexName: 'idx_name', tableName: 'my_table') {
column(name: 'name')
}
rollback() {
dropTable(tableName: 'my_table')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment