Liquibase error with createPartialIndex

Hi Team,

I have an entity UserCert with 1:1 mapping to User entity, note the condition unique = true:

@JoinColumn(name = "USER_ID", unique = true)
@OneToOne(fetch = FetchType.LAZY)
private User user;

Studio creates below changeset:

<changeSet id="22" author="erep">
    <addForeignKeyConstraint baseColumnNames="USER_ID" baseTableName="EREP_USER_CERT"
                             constraintName="FK_EREP_USER_CERT_ON_USER" referencedColumnNames="ID"

    <createPartialIndex indexName="IDX_UC_EREP_USER_CERT_USER" tableName="EREP_USER_CERT" unique="true">
        <column name="USER_ID"/>

This lead to Liquibase error:

[2022-01-21 15:40:12] SEVERE [liquibase.parser] cvc-complex-type.2.4.a: Invalid content was found starting with element 'createPartialIndex'. 

I’m using Studio version 1.1.4 and PostgreSQL.

Similar issue was created in YouTrack: without a solution.

Could you please check this again?

Hi Bryan

See if this helps: Error in liquibase changelog FK Index on ManyToOne with User - #6 by getshahzad

Nope, my entity was created in Jmix using entity designer and the project is not a migration from CUBA. The index statement exists in my entity:

@Table(name = "EREP_USER_CERT", indexes = {
        @Index(name = "IDX_USERCERT_USER_ID", columnList = "USER_ID")

But I can’t reproduce the issue with a new project now.

With a new project, if I create the same entity relationship, it creates a unique constraint and an index as blow instead of the partialIndex:

<addUniqueConstraint columnNames="USER_ID"

<createIndex indexName="IDX_USERCERT_USER_ID"
    <column name="USER_ID"/>

Studio team:
Can you check Jmix Studio code, under what condition, it will generate the createPartialIndex statement?

Reproduced with a new project, seems the Studio will generate createPartialIndex when the entity has traits. Could you please check: (82.5 KB)

Thank you for reporting the problem and providing the sample project. I reproduced the problem, and as you rightly point out, it’s related to traits, or to be precise, the Soft Delete trait. I created a new issue in youtrack

1 Like