Liquibase: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 20: Line 20:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# exclude data
# exclude data
-Pmys,dev,log      # mysql , development
mvn clean install -Pmys,dev,log      # mysql , development
-Pora,pro,log      # oracle, production
mvn clean install -Pora,pro,log      # oracle, production
-Pdev,log          # h2    , development
mvn clean install -Pdev,log          # h2    , development
-Plog              # h2    , development
mvn clean install -Plog              # h2    , development
</syntaxhighlight>
</syntaxhighlight>


Line 29: Line 29:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# include data
# include data
-Pdat,mys,dev,log  # mysql , development
mvn clean install -Pdat,mys,dev,log  # mysql , development
-Pdat,ora,pro,log  # oracle, production
mvn clean install -Pdat,ora,pro,log  # oracle, production
-Pdat,dev,log      # h2    , development
mvn clean install -Pdat,dev,log      # h2    , development
-Pdat,log          # h2    , development
mvn clean install -Pdat,log          # h2    , development
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 42: Line 42:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# exclude data
# exclude data
-Pmys,dev,dif      # mysql , development
mvn clean install -Pmys,dev,dif      # mysql , development
-Pora,pro,dif      # oracle, production
mvn clean install -Pora,pro,dif      # oracle, production
-Pdev,dif          # h2    , development
mvn clean install -Pdev,dif          # h2    , development
-Pdif              # h2    , development
mvn clean install -Pdif              # h2    , development
</syntaxhighlight>
</syntaxhighlight>


Line 51: Line 51:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# include data
# include data
-Pdat,mys,dev,dif  # mysql , development
mvn clean install -Pdat,mys,dev,dif  # mysql , development
-Pdat,ora,pro,dif  # oracle, production
mvn clean install -Pdat,ora,pro,dif  # oracle, production
-Pdat,dev,dif      # h2    , development
mvn clean install -Pdat,dev,dif      # h2    , development
-Pdat,dif          # h2    , development
mvn clean install -Pdat,dif          # h2    , development
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 60: Line 60:
===Synchronize Change Log===
===Synchronize Change Log===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
-Pmys,dev,syn                        # mysql , development
mvn clean install -Pmys,dev,syn                        # mysql , development
-Pora,pro,syn                        # oracle, production
mvn clean install -Pora,pro,syn                        # oracle, production
-Pdev,syn                            # h2    , development
mvn clean install -Pdev,syn                            # h2    , development
-Psyn                                # h2    , development
mvn clean install -Psyn                                # h2    , development
</syntaxhighlight>
</syntaxhighlight>


===Migrate/Update Database===
===Migrate/Update Database===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
-Pmys,dev,upd                        # mysql , development
mvn clean install -Pmys,dev,upd                        # mysql , development
-Pora,pro,upd                        # oracle, production
mvn clean install -Pora,pro,upd                        # oracle, production
-Pdev,upd                            # h2    , development
mvn clean install -Pdev,upd                            # h2    , development
-Pupd                                # h2    , development
mvn clean install -Pupd                                # h2    , development
</syntaxhighlight>
</syntaxhighlight>


===Rollback Change Log===
===Rollback Change Log===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
-Pmys,dev,rol -chorke.tag=20131216  # mysql , development
mvn clean install -Pmys,dev,rol -chorke.tag=20131216  # mysql , development
-Pora,pro,rol -chorke.tag=20131216  # oracle, production
mvn clean install -Pora,pro,rol -chorke.tag=20131216  # oracle, production
-Pdev,rol -chorke.tag=20131216      # h2    , development
mvn clean install -Pdev,rol -chorke.tag=20131216      # h2    , development
-Prol -chorke.tag=20131216          # h2    , development
mvn clean install -Prol -chorke.tag=20131216          # h2    , development
</syntaxhighlight>
</syntaxhighlight>


===Drop All/Clean Database===
===Drop All/Clean Database===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
-Pmys,dev,del                        # mysql , development
mvn clean install -Pmys,dev,del                        # mysql , development
-Pora,pro,del                        # oracle, production
mvn clean install -Pora,pro,del                        # oracle, production
-Pdev,del                            # h2    , development
mvn clean install -Pdev,del                            # h2    , development
-Pdel                                # h2    , development
mvn clean install -Pdel                                # h2    , development
</syntaxhighlight>
</syntaxhighlight>



Revision as of 03:05, 19 September 2018

Path Settings

export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin

Configuration

mkdir -p $HOME/.chorke/etc/liquibase/init
cp ./src/test/resources/liquibase/*.properties $HOME/.chorke/etc/liquibase/init
cd $HOME/.chorke/etc/liquibase/init
explorer .

Maven Commands

Generate Change Log

# exclude data
mvn clean install -Pmys,dev,log      # mysql , development
mvn clean install -Pora,pro,log      # oracle, production
mvn clean install -Pdev,log          # h2    , development
mvn clean install -Plog              # h2    , development
# include data
mvn clean install -Pdat,mys,dev,log   # mysql , development
mvn clean install -Pdat,ora,pro,log   # oracle, production
mvn clean install -Pdat,dev,log       # h2    , development
mvn clean install -Pdat,log           # h2    , development

Generate Diff Change Log

# exclude data
mvn clean install -Pmys,dev,dif      # mysql , development
mvn clean install -Pora,pro,dif      # oracle, production
mvn clean install -Pdev,dif          # h2    , development
mvn clean install -Pdif              # h2    , development
# include data
mvn clean install -Pdat,mys,dev,dif   # mysql , development
mvn clean install -Pdat,ora,pro,dif   # oracle, production
mvn clean install -Pdat,dev,dif       # h2    , development
mvn clean install -Pdat,dif           # h2    , development

Synchronize Change Log

mvn clean install -Pmys,dev,syn                        # mysql , development
mvn clean install -Pora,pro,syn                        # oracle, production
mvn clean install -Pdev,syn                            # h2    , development
mvn clean install -Psyn                                # h2    , development

Migrate/Update Database

mvn clean install -Pmys,dev,upd                        # mysql , development
mvn clean install -Pora,pro,upd                        # oracle, production
mvn clean install -Pdev,upd                            # h2    , development
mvn clean install -Pupd                                # h2    , development

Rollback Change Log

mvn clean install -Pmys,dev,rol -chorke.tag=20131216   # mysql , development
mvn clean install -Pora,pro,rol -chorke.tag=20131216   # oracle, production
mvn clean install -Pdev,rol -chorke.tag=20131216       # h2    , development
mvn clean install -Prol -chorke.tag=20131216           # h2    , development

Drop All/Clean Database

mvn clean install -Pmys,dev,del                        # mysql , development
mvn clean install -Pora,pro,del                        # oracle, production
mvn clean install -Pdev,del                            # h2    , development
mvn clean install -Pdel                                # h2    , development

Profiles

Diff Profiles

Porfile Note Diff Types
dat Include Data tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints,data
default Exclude Data tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints

Database Profiles

Porfile Database Type JDBC Notes
der Apache Derby derby jdbc:derby No Issues
h2d H2 h2 jdbc:h2:file No Issues
hsq HSQL hsqldb jdbc:hsqldb:file No Issues
mys MySQL mysql jdbc:mysql No Issues
ora Oracle oracle jdbc:oracle:thin 11g driver for diff with AL32UTF8 or AL16UTF16
pos PostgreSQL postgresql jdbc:postgresql 8.2+ for drop all database objects
default MySQL mysql jdbc:mysql No Issues

Context Profiles

Porfile Context Notes
dev Development For Development Environment
qac Quality Assurance & Control For QA Environment
uat User Acceptance Test For UAT Environment
pro Production For Production Environment
default Development For Development Environment

Commands Profiles

Porfile Commands Notes
log generateChangeLog Generate Change Log
upd update Migration/Update Database
dif diff Generate Database Diff Change Log
syn changelogSync Synchronize Database with Change Log
rol rollback Rollback Database to the Date/Tag
del dropAll Empty/Clean Database
default generateChangeLog Generate Change Log

Migration

mvn clean install -Pdev,log
mvn clean install -Pdev,syn
mvn clean install -Pdev,upd
mvn clean install -Pdif

mvn clean install -Pqac,syn
mvn clean install -Pqac,upd

mvn clean install -Puat,syn
mvn clean install -Puat,upd

mvn clean install -Ppro,syn
mvn clean install -Ppro,upd

mvn clean install -Ppro,del
mvn clean install -Ppro,rol -chorke.tag=20180806

References