我确信这对于经验丰富的Liquibase用户来说似乎很明显。我想将数据从简单的两个表数据库提取到xml文件。我正在运行的命令是:
java -cp "liquibase.jar;mysql-connector-java/*" "liquibase.integration.commandline.Main" --driver=com.mysql.jdbc.Driver --url=jdbc:mysql://localhost:3306/dti_subcat_mappings --username=myusername --password=mypassword --changeLogFile="C:\temp\category_data.xml" --diffTypes="data" generateChangeLog
运行此命令会生成一个基本为空的xml文件:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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-2.0.xsd"/>
命令输出为:
INFO 8/31/13 8:57 PM:liquibase: Reading tables for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading views for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading foreign keys for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading primary keys for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading columns for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading unique constraints for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Reading indexes for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: Sequences not supported for root@localhost @ jdbc:mysql://localhost:3306/dti_subcat_mappings ...
INFO 8/31/13 8:57 PM:liquibase: C:\temp\category_data.xml exists, appending
INFO 8/31/13 8:57 PM:liquibase: No changes found, nothing to do
Liquibase 'generateChangeLog' Successful
答案 0 :(得分:1)
以下H2数据库示例适用于我:
$ java -cp liquibase-core-3.0.3.jar:h2-1.3.173.jar:snakeyaml-1.12.jar \
liquibase.integration.commandline.Main \
--url=jdbc:h2:db/scottTiger \
--driver=org.h2.Driver \
--username=user \
--password=pass \
--changeLogFile=data.xml \
--diffTypes=data \
generateChangeLog
INFO 01/09/13 09:17:liquibase: data.xml does not exist, creating
Liquibase 'generateChangeLog' Successful
几个问题: