Liquibase 3.7.0为带有autoIncrement的列生成了错误的“ createTable” SQL语句,缺少“由默认身份标识生成”

问题描述 投票:1回答:1

从CLI运行liquibase更新后:

java -cp liquibase-core-3.7.0.jar;liquibase-oracle-3.2.jar;slf4j-api-1.7.25.jar;
slf4j-simple-1.7.25.jar liquibase.integration.commandline.Main ...

我收到以下异常:

liquibase.exception.MigrationFailedException: Migration failed for change set ...
     Reason: liquibase.exception.DatabaseException: ORA-00907: missing right parenthesis
 [Failed SQL: (907) CREATE TABLE table_name (id NUMBER(38, 0)  (START WITH 10000) NOT NULL, ...

这是变更集:

  <changeSet author="changeset_author" id="changeset_id">
    <createTable tableName="table_name" remarks="remarks on table">
      <column autoIncrement="true" name="id" type="BIGINT" startWith="10000" remarks="remarks on column">
        <constraints primaryKey="true"/>
      </column>
      ...
    </createTable>
  </changeSet>

[使用liquibase-core-3.6.3时,具有以下语句的相同变更集已成功执行:

CREATE TABLE table_name (id NUMBER(38, 0) GENERATED BY DEFAULT AS IDENTITY (START WITH 10000) NOT NULL, ...

因此,异常是由于缺少“ DEFAULT AS IDENTITY部分引起的。”

但是,由于slf4j记录问题,我不能使用版本3.6.0-3.6.3。

有人可以建议如何解决此问题吗?谢谢!

oracle liquibase auto-increment
1个回答
0
投票

克服此重大更改的方法是在列标记上设置generationType =“ ALWAYS”,并将更改日志文件设置为使用http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd

无论如何,我认为应该避免让generationType属性为强制性。

© www.soinside.com 2019 - 2024. All rights reserved.