简体   繁体   English

Liquibase 在从 csv 加载数据时会寻找奇怪的路径并引发错误

[英]Liquibase looks for a strange path, when loading data from csv and throws an error

Liquibase version: 4.7 Liquibase 版本:4.7

The path that liquibase is looking for is a combination between the changeset path and the csv content. liquibase 正在寻找的路径是变更集路径和 csv 内容之间的组合。

Error message错误信息

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/v2_1_data_update.xml::20210206-1_local::beng:
     Reason: java.nio.file.InvalidPathException: Illegal char <"> at index 30: config/liquibase/changelog\[{ "attId": 0, "refSystem": "MOXIS",

Change set for loading the data, that is failing:用于加载数据的更改集,失败:

 <changeSet id="20210206-1_local" author="beng" context="dev" dbms="h2">
        <comment>load moxis documents test data for internal users 21-30</comment>
        <loadData encoding="UTF-8"
                  file="config/liquibase/csv/dev/documentsmoxis_devh2.csv"
                  separator=";"
                  tableName="document">
            <column name="visible_until" type="datetime"/>
            <column name="document_date" type="date"/>
            <column name="expires_on" type="datetime"/>
            <column name="form" type="boolean"/>
            <column name="check_processed" type="boolean"/>
        </loadData>
    </changeSet>

Adding the last 3 columns to the table:将最后 3 列添加到表中:

<changeSet id="20210204-1" author="beng">
        <comment>Adding action_required,ref_system,attachments columns to table document</comment>
        <addColumn tableName="document">
            <column name="action_required" type="varchar(255)">
                <constraints nullable="true"/>
            </column>
            <column name="ref_system" type="varchar(255)">
                <constraints nullable="true"/>
            </column>
            <column name="attachments" type="clob">
                <constraints nullable="true"/>
            </column>
        </addColumn>
    </changeSet>

Csv file, from where the data is loaded CSV 文件,从其中加载数据

.csv 文件

If my memory serves me right LB considers column config in changeset as a "hint", but the real load scenario is based on column config, table metadata and CVS, in your case attachments column is present in table and has LOB type, so LB assumes that you are trying to load LOB from file.如果我的记忆对我有帮助,LB 将变更集中的列配置视为“提示”,但真正的负载方案基于列配置、表元数据和 CVS,在您的情况下, attachments列存在于表中并且具有 LOB 类型,因此 LB假设您正在尝试从文件加载 LOB。 Try explicitly exclude attachments column from loading:尝试从加载中明确排除attachments列:

<column name="attachments" type="skip"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM