Expose Liquibase generation as a Gradle task or MCP tool

I use AI a lot for drafting code. One issue I have run into repeatedly is generating stable, consistent Liquibase scripts.

Even with the Jmix skills and my own additional instructions on top, the AI-generated Liquibase scripts are not consistent.

Index names and structure are a major issue. Indexes are repeatedly being dropped and re-created because the AI-generated version does not match Jmix expectations.

Instead of trying to use AI to generate scripts, it would be safer and easier to have the AI call the existing script generation.

I guess this could be a Gradle script or, in the short term, an MCP tool that can call the Jmix capability.

Hi Tom,

Thank you for the idea, we’ll consider it.
Another approach could be to make Studio more tolerant of existing indexes.

Created issue: https://youtrack.jmix.io/issue/JST-6639

Regards,
Konstantin

Another approach could be to make Studio more tolerant of existing indexes.

Won’t be enough. It’s not just naming, It’s really an inocrrect script. You could try improving skills but I also already experimented and not getting deterministic results.

One recurring problem is missing partial indexes on postgres unique constrains. About half of the time it omits the partial index

    <modifySql>
        <append value="where DELETED_DATE is null"/>
    </modifySql>

@krivopustov
I just ran into it again right now. And because the entities are in an addon I now have to go fix a bunch of environments.
This happened before and gives a lot of extra work.

Currently I have no way of detecting if a db is up-to-date vs the liquibase scripts.
I have loads of ArchUnit tests.
I should be able to write a simple integration test to check if my db is equivalent to the entities so that the build fails when it’s not.

Perhaps that test should be even provided by the framework. If db is not up-to-date with entities then a script is missing and pipelines should fail and definitely not deploy

1 Like

Regarding Liquibase generation by agents, the first and the simplest thing to do is to improve the skill:

That’s a good idea. We are going to implement some checking (linting) tools to give agents better feedback on the generated code, and this one could be one of them.