Suggestion: define a default value for a field

Hello,

When i add a new field to an existing class, if there is data and the field is not null i have to fix it in steps, first create the field, next update data and finally set the field to not null, However it can be fixed if its defined a default value for the new field, that should be set in the definition of the field in the database or maybe only alt liquibase level using defaultvalue.

In my case i modified the script adding defaultValue to reduce steps:

<changeSet author="mngc" id="1">
    <addColumn tableName="MNGC_PERSONA">
        <column name="NOMBRE_TIPO" type="VARCHAR(255)" defaultValue="COR">
            <constraints nullable="false"/>
        </column>
    </addColumn>
</changeSet>

Hi,
You are not alone with this idea.
We have this feature in CUBA Studio backlog for a while:
https://youtrack.cuba-platform.com/issue/STUDIO-3817

We keep this feature in one mind, there is a chance we will implement it in Jmix if have enough resources.

1 Like