In Jmix 3.0 when I want to check the entity-log I get the following error and I cannot do anything. I think it is a typo ?
Regards
Felix
SQLSyntaxErrorException: (conn=4696) Unknown column ‘AUTO_’ in ‘SELECT’
In Jmix 3.0 when I want to check the entity-log I get the following error and I cannot do anything. I think it is a typo ?
Regards
Felix
SQLSyntaxErrorException: (conn=4696) Unknown column ‘AUTO_’ in ‘SELECT’
Hi Felix,
Thanks for reporting this.
I tried to reproduce it on Jmix 3.0 (3.0.999-SNAPSHOT / master) with MariaDB 10.7.1, but the problem does not reproduce — the Entity Log view opens fine and the AUDIT_LOGGED_ENTITY table has the columns AUTO_ and MANUAL_ as expected.
This is most likely related to ticket #4896 (“Cannot use Audit add-on with MySQL 8.4+”). Within that fix the LoggedEntity fields were renamed to map to the AUTO_ / MANUAL_ columns (because AUTO and MANUAL are reserved words in MySQL 8.4+), and a new changelog 004-audit.xml was added to rename the existing AUTO / MANUAL columns to AUTO_ / MANUAL_.
The error “Unknown column ‘AUTO*’” means your application code already expects AUTO*, but in your database the column is still named AUTO — i.e. the rename from 004-audit.xml was not applied to your schema.
Could you please share a bit more so we can pinpoint it:
Your MariaDB version.
Whether the rows for 004-audit.xml are present in the DATABASECHANGELOG table and their status:
SELECT ID, AUTHOR, FILENAME, DATEEXECUTED, EXECTYPE FROM DATABASECHANGELOG WHERE FILENAME LIKE '%004-audit.xml%';
The actual column names in the table:
SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'AUDIT_LOGGED_ENTITY';
If it turns out the changelog was not applied, there are two cases:
If the 004-audit.xml rows are missing from DATABASECHANGELOG and the columns are still AUTO / MANUAL, the migration simply has not run yet — restarting the application on the fixed version should apply it (make sure Liquibase runs at startup and the DB user has ALTER privileges).
If the 004-audit.xml rows are already marked as executed but the columns are still AUTO / MANUAL (the rename did not actually take effect), you can rename them manually:
ALTER TABLE AUDIT_LOGGED_ENTITY CHANGE AUTO AUTO_ TINYINT(1);
ALTER TABLE AUDIT_LOGGED_ENTITY CHANGE MANUAL MANUAL_ TINYINT(1);
Best regards,
Igor
Hi Igor,
Thank you very much for your thorough explanations!
I also took a look at Cannot use Audit add-on with MySQL 8.4+ · Issue #4896 · jmix-framework/jmix · GitHub. We can’t use Liquibase in our case, because—besides various other issues—it can delete existing client data. For example, when changing a column’s datatype, Liquibase may remove the old field (including its data) and then add a new empty field, and this behavior can lead to data loss.
So you’re absolutely right: this 004-audit.xml file never actually ran in our setup.
I also checked Release 3.0 :: Jmix Documentation and couldn’t find any note about this newly introduced fields. I think it would be helpful if you could mention it explicitly in the documentation.
Best regards,
Felix