Skip to content

willitscale/SampleJsonLiquibase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample JSON Liquibase

A sample liquibase set-up using JSON

Setting up liquibase

Here's a very basic set-up guide to get going with liquibase in Ubuntu 14.04 3.13.0-79-generic

sudo apt-get install openjdk-7-jre
sudo mkdir -p /usr/local/liquibase
cd /usr/local/liquibase
sudo wget https://github.com/liquibase/liquibase/releases/download/liquibase-parent-3.4.2/liquibase-3.4.2-bin.tar.gz
sudo tar -xvf liquibase-3.4.2-bin.tar.gz
sudo rm liquibase-3.4.2-bin.tar.gz
sudo ln -s liquibase /usr/bin/liquibase
cd ~/
git clone https://github.com/willitscale/SampleJsonLiquibase.git
cd SampleJsonLiquibase

Configuration

You will need to either set-up a database server locally or have a remote database access available. This example is assuming that your dbms is MySQL with the username 'admin' and password 'password' and you will have to adjust the liquibase.properties to reflect your set-up. If you require any additional drivers I would suggest oracle-jdbc.

Initial Tag

Tags the initial structure as your "base" or starting point.

liquibase tag "base"

Updates

Each update should execute the defined changes and then tag the changes as outlined.

Creates the table 'person' in 'test' and tags the structure as 'TEST-1000'

liquibase --changeLogFile=changes/TEST-1000/changeSet.json update

Alters the 'person' table with the additional field 'lastname' and tags the structure as 'TEST-1001'

liquibase --changeLogFile=changes/TEST-1001/changeSet.json update

Imports data to the 'person' table and tags the structure as 'TEST-1002'

liquibase --changeLogFile=changes/TEST-1002/changeSet.json update

Rollbacks

Drops all the data from the 'person' table and reverts to the tag 'TEST-1001'

liquibase --changeLogFile=changes/TEST-1002/changeSet.json rollback "TEST-1001"

Drops the 'lastname' column and reverts to the tag 'TEST-1000'

liquibase --changeLogFile=changes/TEST-1001/changeSet.json rollback "TEST-1000"

Drops 'person' table and reverts to the tag 'base'

liquibase --changeLogFile=changes/TEST-1000/changeSet.json rollback "base"

About

Example JSON Liquibase Flow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published