无法使用Liquibase中的序列在表中插入值

som*_*ame 2 postgresql liquibase jhipster

我想使用sequence_name.NEXTVAL自动计算liquibase中列的值.后端数据库是postgresql.我尝试使用"valueComputed"属性,如此链接所示.但它不是使用序列计算值,并且列的值在插入时为空.我们如何使用序列自动增加liquibase中的列?提前谢谢你的帮助.

我的代码如下:

    <changeSet id="20151020000" author="jhipster">      

    <createSequence cycle="false" incrementBy="1" maxValue="1000"  minValue="50" sequenceName="seq_name" startValue="50"/>

    <createTable tableName="tablename">
                <column name="id" type="bigint" valueComputed ="seq_name.NEXTVAL">
                    <constraints primaryKey="true" nullable="false"/>
                </column>
   </createTable>
Run Code Online (Sandbox Code Playgroud)

dfc*_*che 10

这对我有用:

<createTable tableName="tablename">
    <column name="id" type="bigint" defaultValueSequenceNext="seq_name">
        <constraints primaryKey="true" nullable="false"/>
    </column>
</createTable>
Run Code Online (Sandbox Code Playgroud)