I have read this thread JMIX with Liquibase - #4 by krivopustov
and I agree that such a checkbox would be very useful, and I have some ideas to propose further so that studio users can get more control over Liquibase.
- ability to invoke Changelog Preview from the Jmix Data Store menu - now it’s appearing only after one starts Run Jmix Application
This is a very useful screen that already exists - perhaps it can be invoked with “Save and run” and “Discard and run” buttons set to disabled and not visible
- a sort of “simulated run”
- ability to right-click an entity, or a table in such screen, and have few simple preconditions to toggle from Liquibase changelog , such as:
create table if not exists
<changeSet id="create-table-if-not-exists" author="mladen">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="my_table"/>
</not>
</preConditions>
or add a column if not exist for fine-grained control
<changeSet id="add-column-if-not-exists" author="mladen">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="my_table" columnName="email"/>
</not>
</preConditions>
and if exists leave it alone , this is important for the platform and addon entity changelogs
As well as related common useful preconditions.
-
Granular entity attribute control - example I have a Map add-on, I change the geo polygon default size from its small default to say 40k to accommodate the size, if this “modifyDataType” is not ignored it can truncate the data, so it would be good if we can right-click column name/attribute somewhere and set it to not be touched
-
Something cool but not really important if we add some manual precondition like this example
<preConditions onFail="MARK_RAN">
<not>
<and>
<sqlCheck expectedResult="1">
SELECT COUNT(*) FROM public.PCL_USER WHERE ID = 'xx-x-x-xxx-x'
</sqlCheck>
<sqlCheck expectedResult="1">
SELECT COUNT(*) FROM public.PCL_USER WHERE USERNAME = 'admin'
</sqlCheck>
</and>
</not>
</preConditions>
→ have Studio mark somehow the changelog that was manually edited
Also, preconditions are cool if you write an application that uses several database types
<changeSet id="mysql-specific-change" author="mladen">
<preConditions onFail="MARK_RAN">
<dbms type="mysql"/>
</preConditions>
<createTable tableName="my_table">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true"/>
</column>
<column name="name" type="varchar(255)"/>
</createTable>
</changeSet>
- Does this deserve, if gone far, a central Liquibase management screen where all this can be invoked, changelogs edited, entities right-clicked, simulations run, Ignored section managed and viewed?
Kind regards,
Mladen
and it builds on that thread functionality, later on it can be expanded to some sort of code snippets for preconditions if needed, but just “if not exist” button to add-remove this on table, and column would be fantastic