如何使用 Liquibase 定义具有升序/降序列的表索引,最后为空

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

使用原生查询

CREATE INDEX IF NOT EXISTS index
    ON public.table USING btree
    (column1 ASC NULLS LAST, column2 ASC NULLS LAST); 

如何使用 Liquibase 定义类似索引?

<createIndex tableName="table" indexName="ACT_IDX_table" unique="true">
     <column name="column1" />
     <column name="column2" />
</createIndex>

数据库-Postgres

postgresql liquibase
1个回答
0
投票

据我所知,您无法在 liquibase 中最后设置 NULL。当然,您始终可以使用标签来准确编写您需要的内容。

<sql>
   CREATE INDEX IF NOT EXISTS index
   ON public.table USING btree
   (column1 ASC NULLS LAST, column2 ASC NULLS LAST); 
</sql>
© www.soinside.com 2019 - 2024. All rights reserved.