Field from entity A moved to entity B due upgrading database scripts

Hello everyone, I got next warning message when try to upgrade database scripts.

“Mandatory reference column CONCOURSE_ID is going to be added into the table BASE_PERSON_GROUP. This change may cause exception on database update if table contains data. To prevent this to happen you need to add not mandatory column first, then update existing data and set column mandatory. Use commented statements as template, replace default_value with actual reference id. Do not forget to get rid of initial statement.”

I’m new in CUBA, so don’t have idea to solve this. Because of this when I try to run scripts in BASE_PERSON_GROUP I got error from sql that column does not exists.
Who can help me?

Hi,

The simplest thing you can do is to remove “mandatory” flag from the attribute associated with the CONCOURSE_ID column.
Then delete previously generated script and re-generate them again.

Adding a mandatory field to the table with already existing data in it is a non-trivial thing.

Otherwise, if you need a mandatory field, you can empty the BASE_PERSON_GROUP table to get rid of the conflict.

1 Like

Thanks, that’s works!