经过这么多次的努力,我得到了解决方案.
按照以下步骤从现有MySQL数据库生成迁移.
使用以下行将初始migrations.xml添加到项目中.
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">
运行:使用dropwizard的“db migrate”进行迁移,它将在Database中创建databaseChangeLog和databaseChangeLogLock表.
根据需要运行以下命令.
命令语法:
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可以参考此link或link以获取上述常用参数
注意:如果你没有,命令需要[DB驱动程序jar的路径],JDBC.jar文件.