Hello all!
Just create an empty project with Jmix 2.6.1 with MariaDB and it is not even possible to login !!
As mentioned in the documentation, using MariaDB currently requires downgrading the Liquibase version. I understand and agree that this is inconvenient. The requirement to add this line to build.gradle
will be removed in the next release.
There is a check, if the input object is a string and in this case, there are - inserted in the string. I think a simple check, if these - are already there (and in this case not adding them again), and the problem is solved.
@f.zehnder, unfortunately, this simple check is not enough to solve the whole issue. Yes, it will prevent the exception you mentioned and allow the value to be read from db. But then a new problem occurs: saving UUID values to the DB.
For existing projects:
We cannot use the new format (with dashes). In that case we either won’t be able to save an entity with foreign keys (because the ID format of the referenced entity has not been updated yet), or we will have to force every MariaDB project to perform a full db migration of PK and FK columns.
We also cannot use the old format (without dashes). UUID colums newly created by liquibase 4.25.1+ will not accept values in the old format.
Moreover, this is not only Jmix conversion problem. Imagine that there is no Jmix – just a simple app with MariaDB (e.g. 11.8.3) and Liquibase:
- Some tables were created using an older version of Liquibase (4.25.0 or earlier).
- Liquibase was updated.
- A new entity with a Liquibase changelog was added.
- When executing this changelog to create a table for the new entity, you get:
ERROR: Exception Primary Source: MariaDB 11.8.3-MariaDB-ubu2404
Unexpected error running Liquibase: liquibase.exception.MigrationFailedException: Migration failed for changeset com/company/mariatst2/liquibase/changelog/2025/09/29-181318-8ce57fb5.xml::2::mariatst2:
Reason: liquibase.exception.DatabaseException: (conn=392) Can't create table `mariatst2`.`TEST2` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE mariatst2.TEST2 ADD CONSTRAINT FK_TEST2_ON_TEST1 FOREIGN KEY (TEST1_ID) REFERENCES mariatst2.TEST (ID)]
For more information, please use the --logLevel flag
Exception in thread "main" liquibase.exception.LiquibaseException: Unexpected error running Liquibase: liquibase.exception.MigrationFailedException: Migration failed for changeset com/company/mariatst2/liquibase/changelog/2025/09/29-181318-8ce57fb5.xml::2::mariatst2:
Reason: liquibase.exception.DatabaseException: (conn=392) Can't create table `mariatst2`.`TEST2` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE mariatst2.TEST2 ADD CONSTRAINT FK_TEST2_ON_TEST1 FOREIGN KEY (TEST1_ID) REFERENCES mariatst2.TEST (ID)]
at liquibase.integration.commandline.Main$1.run(Main.java:442)
at liquibase.integration.commandline.Main$1.run(Main.java:225)
at liquibase.Scope.child(Scope.java:210)
at liquibase.Scope.child(Scope.java:186)
at liquibase.integration.commandline.Main.run(Main.java:225)
at liquibase.integration.commandline.Main.main(Main.java:164)
It happens because an FK cannot be created between UUID
and CHAR(36)
columns. Liquibase also does not provide an easy solution to generate CHAR(36)
columns on already existing databases.
So, the problem is not a simple check. The real issue is that upgrading Liquibase makes further development on existing DBs impossible without either:
- migrating all
CHAR(36)
ID columns to UUID
type, or
- migrating all Liquibase changelogs to replace the
uuid
type with char(36)
and then dealing with checksum changes (if Liquibase uuid
is replaced by varchar
, as @dmitchell suggested).
For new projects:
As for new projects, we may face similar issues using a newer Liquibase version with MariaDB 10.6 ( which is still in use and does not support the UUID
column type). For MariaDB 10.6 Liquibase still creates CHAR(36)
columns. So, if someone creates a new project on a newer Liquibase version with MariaDB 10.6 and then tries to migrate to MariaDB 10.7+, they will encounter the same Foreign key constraint is incorrectly formed
exception for newly added entities.
Thus, at the moment, the only reliable way to support all MariaDB versions without forcing very inconvenient migrations is to pin the Liquibase version.
We are considering possible solutions for one of the future releases when Liquibase version will be updated and will provide additional information once we implement one of them.
Regards,
Dmitry