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