I have tried to create liquibase XML existing from MySQL database. My goal is to generate liquibase XML schema from MySQL database.
Any way to achieve this solution.
I have already tried with dropwizard command
java -jar myjar-4.1.0.jar --changeLogFile="generate.xml" --diffTypes="data" generateChangeLog
but it does not work for me.
After trying so many time finally I got my solution.
Follow following steps to generate migration from existing MySQL database. Add initial migrations.xml into the project with below lines.
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
</databaseChangeLog>
Run: above migration with "db migrate" for dropwizard, it'll create databaseChangeLog and databaseChangeLogLock tables into Database.
Run Following command as per requirement.
Command Syntax :
liquibase --driver=com.mysql.jdbc.Driver --classpath=[path to db driver jar] --changeLogFile=[Path to above migration.xml] --url=[Database URL] --username=[Username] --password=[Password] [command parameters]
U can refer this link or link for above common parameter
Note: Command require [path to DB driver jar], JDBC.jar file for this if you don't have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With