Liquibase Changelog generation not working in new Projekt

I have created a new project, created some entities which were initially recognised as a changelog.

After I restarted IntelliJ, no more changelogs are created.

When I check manually, JMIX Studio says that database and changelogs are synced.

image
image

Changelog:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"
        objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
    <changeSet id="1" author="core">
        <createTable tableName="CORE_MACHINE">
            <column name="ID" type="UUID">
                <constraints nullable="false" primaryKey="true" primaryKeyName="PK_CORE_MACHINE"/>
            </column>
            <column name="NAME" type="VARCHAR(255)">
                <constraints nullable="false"/>
            </column>
            <column name="LAST_MODIFIED_BY" type="VARCHAR(255)"/>
            <column name="LAST_MODIFIED_DATE" type="timestamp with time zone"/>
            <column name="CREATED_BY" type="VARCHAR(255)"/>
            <column name="CREATED_DATE" type="timestamp with time zone"/>
        </createTable>
    </changeSet>
</databaseChangeLog>

IntelliJ Log:

2023-12-16 17:50:43,964 [ 428796]   INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from C:/Users/Jan Heil/.jdks/corretto-17.0.9
2023-12-16 17:50:43,971 [ 428803]   INFO - #o.j.p.g.s.e.GradleExecutionHelper - Passing command-line to Gradle Tooling API: bootRun --init-script C:\Users\JANHEI~1\AppData\Local\Temp\ijMapper1.gradle --init-script C:\Users\JANHEI~1\AppData\Local\Temp\ijresolvers3.gradle -Didea.active=true -Didea.version=2023.3.2 -Didea.vendor.name=JetBrains
2023-12-16 17:50:47,743 [ 432575]   INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from C:/Users/Jan Heil/.jdks/corretto-17.0.9
2023-12-16 17:50:48,764 [ 433596]   INFO - liquibase.database - Set default schema name to PUBLIC
2023-12-16 17:50:48,769 [ 433601]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_CORE_PORT
2023-12-16 17:50:48,770 [ 433602]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_PORT_HOSTNAME
2023-12-16 17:50:48,776 [ 433608]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_PORT_HOSTNAME
2023-12-16 17:50:48,777 [ 433609]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_CORE_HOSTNAME
2023-12-16 17:50:48,777 [ 433609]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_HOSTNAME_MACHINES
2023-12-16 17:50:48,777 [ 433609]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_HOSTNAME_MACHINE
2023-12-16 17:50:48,781 [ 433613]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_HOSTNAME_MACHINES
2023-12-16 17:50:48,782 [ 433614]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_HOSTNAME_MACHINE
2023-12-16 17:50:48,782 [ 433614]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_CORE_MACHINE
2023-12-16 17:50:48,786 [ 433618]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_EMAIL_SENDING_ATTACHMENT
2023-12-16 17:50:48,795 [ 433627]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_EMAIL_SENDING_MESSAGE
2023-12-16 17:50:48,803 [ 433635]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_ROW_LEVEL_ROLE
2023-12-16 17:50:48,808 [ 433640]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_USER_SUBSTITUTION
2023-12-16 17:50:48,813 [ 433645]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_FLOWUI_USER_SETTINGS
2023-12-16 17:50:48,816 [ 433648]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_CORE_USER
2023-12-16 17:50:48,816 [ 433648]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_USER_ON_USERNAME
2023-12-16 17:50:48,821 [ 433653]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_USER_ON_USERNAME
2023-12-16 17:50:48,821 [ 433653]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_ROLE_ASSIGNMENT
2023-12-16 17:50:48,826 [ 433658]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_ROW_LEVEL_POLICY
2023-12-16 17:50:48,832 [ 433664]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_CORE_VOLUME
2023-12-16 17:50:48,832 [ 433664]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_VOLUME_MACHINE
2023-12-16 17:50:48,836 [ 433668]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found index IDX_CORE_VOLUME_MACHINE
2023-12-16 17:50:48,836 [ 433668]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_RESOURCE_POLICY
2023-12-16 17:50:48,843 [ 433675]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_SEC_RESOURCE_ROLE
2023-12-16 17:50:48,848 [ 433680]   INFO - #liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator - Found primary key PK_FLOWUI_FILTER_CONFIGURATION
2023-12-16 17:50:48,908 [ 433740]   INFO - liquibase.command - Diff command completed
2023-12-16 17:50:48,908 [ 433740]   INFO - STDOUT - BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed. Some database objects and their dependencies cannot be represented automatically, and they may need to be manually updated before being deployed.
2023-12-16 17:50:48,914 [ 433746]   WARN - liquibase.ext - Diff changelog command failed
2023-12-16 17:50:48,914 [ 433746]   INFO - liquibase.command - Command execution complete
2023-12-16 17:50:49,150 [ 433982]   INFO - #c.i.u.WinFocusStealer - Foreground lock timeout set to 0
2023-12-16 17:50:49,435 [ 434267]   INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from C:/Users/Jan Heil/.jdks/corretto-17.0.9
2023-12-16 17:50:49,435 [ 434267]   INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from C:/Users/Jan Heil/.jdks/corretto-17.0.9
2023-12-16 17:50:49,477 [ 434309]   INFO - #o.j.p.g.s.e.GradleExecutionHelper - Passing command-line to Gradle Tooling API: bootRun --init-script C:\Users\JANHEI~1\AppData\Local\Temp\ijMapper1.gradle --init-script C:\Users\JANHEI~1\AppData\Local\Temp\ijresolvers4.gradle -Didea.active=true -Didea.version=2023.3.2 -Didea.vendor.name=JetBrains
2023-12-16 17:51:03,233 [ 448065]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files

I already had the problem in an older, larger project, because I could not fix the error, I quickly created a new project and lo and behold, the same problem.

JMIX Studio or Liquibase simply do not recognise entity / JPA changes.

image

JMIX Studio Version: 2.1.1-233
IntelliJ Version: IU-233.13135.65
Liquibase Version: 4.20.0 #7837, kompiliert am 2023-03-07 16:25+0000

1 Like

Am I doing something wrong or why are changelogs no longer being generated for new entities? I am using a new clean project…

I now use a nightly version as recommended in a thread and at least get stacktraces.

Studio doesn’t create liquibase script to create entities when connected to a new main database - Support - Jmix

image

package de.bytestore.core.hosting.entity;

import io.jmix.core.DeletePolicy;
import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.entity.annotation.OnDeleteInverse;
import io.jmix.core.metamodel.annotation.JmixEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.OffsetDateTime;
import java.util.UUID;

@JmixEntity
@Table(name = "CORE_HOSTNAME", indexes = {
        @Index(name = "IDX_CORE_HOSTNAME_MACHINES", columnList = "MACHINES_ID"),
        @Index(name = "IDX_CORE_HOSTNAME_MACHINE", columnList = "MACHINE_ID")
})
@Entity(name = "core_Hostname")
public class Hostname {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @Column(name = "ADDRESS")
    private String address;

    @OnDeleteInverse(DeletePolicy.UNLINK)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @NotNull
    @JoinColumn(name = "MACHINE_ID", nullable = false)
    private Machine machine;

    @CreatedBy
    @Column(name = "CREATED_BY")
    private String createdBy;

    @CreatedDate
    @Column(name = "CREATED_DATE")
    private OffsetDateTime createdDate;

    @LastModifiedBy
    @Column(name = "LAST_MODIFIED_BY")
    private String lastModifiedBy;

    @LastModifiedDate
    @Column(name = "LAST_MODIFIED_DATE")
    private OffsetDateTime lastModifiedDate;

    public Machine getMachine() {
        return machine;
    }

    public void setMachine(Machine machine) {
        this.machine = machine;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public OffsetDateTime getLastModifiedDate() {
        return lastModifiedDate;
    }

    public void setLastModifiedDate(OffsetDateTime lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    public String getLastModifiedBy() {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(String lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    public OffsetDateTime getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(OffsetDateTime createdDate) {
        this.createdDate = createdDate;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }
}

Hello, could you please provide a new idea.log file generated from the nightly version?

The funny thing is that everything worked before and suddenly it stopped working in new projects and old projects without errors.

Was there possibly a Liquibase update that is now no longer compatible?

After updating JMIX Studio, I received error logs, so I quickly deleted the entity that was causing the error and recreated it 1:1 via the GUI.

The funny thing is that both files with the same settings are not identical.

It looks like there are problems with the JoinColumn annotation.

I will attach the log in my old thread…

Liquibase Error when using logback.xml in JMIX Project - Support - Jmix

Hi, i have the same problem. I created a new project (Jmix 2.1.1, latest Studio Version). At the beginning the changelogs were still created. Later I deleted all of them and tried to create new ones, which resulted in the same error.

Hello, thanks for reporting. Could you please install nightly version of Jmix Studio, run updates again and share you idea.log with us? This will help determine the real source of the problem.

Hi, with the Nightly Build version I get at least an error message similar to @JaXnPriVate .The problem was that I had defined an index for an attribute that no longer exists.
I think in @JaXnPriVate example the column MACHINES_ID also doesn’t exists.

idea.log (93.2 KB)

Thank you. You’re right, it looks like Studio hasn’t generated changelogs for non-existent columns for a while, but does so now and then silently crashes when updating the database. Now the issues will be easier to fix. We verify that the index definitions are validated correctly and look for the reason why these indexes might be generated this way. If you notice strange behavior when working with entities, please report it.

I had the same or identical problem. No JoinColumn annotation was set, after regenerating the entity the error was gone, this time a JoinColumn was set with the new version of JMIX.