使用hsqldb命名liquibase表时出错(在内存中)。需要一个解决方法

时间:2022-07-05 02:06:58

I'm using liquibase on a project and i just realize what makes my build fails.i've successfully use command line generateChangeLog against the same schema in mysql and included that file in my master-change-log file.

我正在项目上使用liquibase,我只是意识到是什么让我的构建失败。我已经成功地使用命令行generateChangeLog对着mysql中的相同模式,并将该文件包含在我的master-change-log文件中。

For test environment i use hsqldb.Now all the table name are hyphen separated apart from language.Since my build were failing i opened my mydb.script and all the hyphen separated Tables name were in capital but language looks like this

对于测试环境,我使用hsqldb.Now所有表名都是与语言分开的连字符。因为我的构建失败了我打开了我的mydb.script并且所有连字符分隔的表名都是大写但语言看起来像这样

CREATE MEMORY TABLE SOME_TABLE(ID BIGINT NOT NULL,OBJ_VESION INTEGER DEFAULT 0 NOT NULL,REQUESTER_PHONE VARCHAR(20),FORM_CODE VARCHAR(100),DATE_STARTED TIMESTAMP,DATE_ENDED TIMESTAMP,LAST_ACTIVITY TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,SOME_TABLE_STATUS VARCHAR(255),CONSTRAINT PK_INCOMING_MESSAGE_SESSION PRIMARY KEY(ID))  

CREATE MEMORY TABLE "language"(ID BIGINT NOT NULL,CODE VARCHAR(10),NAME VARCHAR(50),DESCRIPTION VARCHAR(255),CONSTRAINT PK_LANGUAGE PRIMARY KEY(ID))

and in the change log file they look like this

在更改日志文件中,它们看起来像这样

<changeSet author="highjo (generated)" id="1282409084036-10">
    <createTable tableName="some_table">
        <column name="id" type="BIGINT">
            <constraints nullable="false" primaryKey="true"/>
        </column>
        <column defaultValueNumeric="0" name="obj_vesion" type="INT">
            <constraints nullable="false"/>
        </column>
       <!-- ... -->
    </createTable>
</changeSet>
<changeSet author="highjo (generated)" id="1282409084036-11">
    <createTable tableName="language">
        <column name="id" type="BIGINT">
            <constraints nullable="false" primaryKey="true"/>
        </column>
        <column name="code" type="VARCHAR(10)"/>
        <!-- .... -->
    </createTable>
</changeSet>

as you can notice they are all in small letters in the changelog file.I've tried changing in the change log language to capital, and in the script it is in capital just that it still has the double quote. :(

你可以注意到它们在changelog文件中都是小写字母。我已经尝试将更改日志语言更改为大写,并且在脚本中它只是在资本中它仍然具有双引号。 :(

How it is possible to fix this? thanks for reading.

怎么可能解决这个问题?谢谢阅读。

1 个解决方案

#1


0  

I think the reason language is quoted is because it us a reserved word in hsql and so liquibase quotes it so the SQL doesn't fail.

我认为引用语言的原因是因为它是hsql中的保留字,因此liquibase引用它以便SQL不会失败。

The escaping rules may have changed for liquibase 2.0, but if not you could override the escapeObject method in q custom database class easier and see if it works.

liquibase 2.0的转义规则可能已更改,但如果不是,您可以更轻松地覆盖q自定义数据库类中的escapeObject方法并查看它是否有效。

The quotes shouldn't matter, though. They shouldn't occur in the table name itself.

但报价无关紧要。它们不应出现在表名本身中。

#1


0  

I think the reason language is quoted is because it us a reserved word in hsql and so liquibase quotes it so the SQL doesn't fail.

我认为引用语言的原因是因为它是hsql中的保留字,因此liquibase引用它以便SQL不会失败。

The escaping rules may have changed for liquibase 2.0, but if not you could override the escapeObject method in q custom database class easier and see if it works.

liquibase 2.0的转义规则可能已更改,但如果不是,您可以更轻松地覆盖q自定义数据库类中的escapeObject方法并查看它是否有效。

The quotes shouldn't matter, though. They shouldn't occur in the table name itself.

但报价无关紧要。它们不应出现在表名本身中。