0

我敢肯定,这对于有经验的 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
4

1 回答 1

0

以下 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

几个问题:

  • 您似乎使用的是 2.0 版(变更集声明)。您是否尝试过升级到 3.0?
  • 您确定要连接到正确的架构吗?
于 2013-09-01T08:21:57.830 回答