MySQL database changelog

If you need a database changelog between two MySQL schemas, give Liquibase a try. First you have to create a XML diff change log between the old and the new schema.

java -jar liquibase-1.9.4.jar --driver=com.mysql.jdbc.Driver --classpath=mysql-connector-java-5.1.7-bin.jar --url=jdbc:mysql://localhost:3306/schemaNew --username=xxx --password=xxx diffChangeLog --baseUrl=jdbc:mysql://localhost:3306/schemaOld --baseUsername=xxx --basePassword=xxx > changelog.xml

With this XML file you are able to create an update SQL DDL file containing all changes to push the old schema up to the new one.

java -jar liquibase-1.9.4.jar --driver=com.mysql.jdbc.Driver --classpath=mysql-connector-java-5.1.7-bin.jar --url=jdbc:mysql://localhost:3306/schemaOld --username=root --password=xxx --changeLogFile=changelog.xml updateSQL > changelog.sql
Short URL for this post: http://wp.me/p4nxik-l9
This entry was posted in Java Persistence and tagged , , . Bookmark the permalink.