Mandatory Field

Hi, it’s possible when we add a new mandatory field on an existing table, to not get error of null in Database?

Example:

Table Customer (without salesman Field).

After we work some days, i attach new table Salesman, with relation Many to One with Customer, and set Mandatory in Customer Side.

I cannot deploy changes in Database if existing records, and cannot set a default value… not exists anything in Salesman Table. (table not exists).

It’s possible to deploy, and then when i go to each customer, set their Salesman ¿?

Hi Ivan,
Studio automatically generates updates to a new mandatory field only if this field is of a simple type (not a reference). Just because Studio doesn’t know what should be a default value for your mandatory reference. If you add such field and you want to update your existing data, please add an “update” SQL statement to the update script generated by Studio. It can be done right on the “Database scripts” page in Studio, or later edit the script located in the modules/core/db folder of your project.

Thanks Konstantin!