Domain - changes made on xml not reflected on DB

Hi,
I need to change the not null constraint of field Y of table X, I have removed the required=true for field Y in the doman/X.xml. I expected the change to be reflected on field Y on DB but in DB i still have ‹ not null › set for the field. The change I made on the domain is not reflected on DB

Can you please let me know how to fix this

best regards
Richard

1 « J'aime »

Hello,

Make sure that in the POJO, corresponding to table X, generated in the build/src-gen/java directory, the @NotNull tag of the attribute corresponding to field Y has been removed.
If so, you can modify this constraint directly in column Y of table X.
Example for PostgreSql:
ALTER TABLE X ALTER COLUMN Y DROP NOT NULL;

Regards

Hi PakMax,
Thank you for the quick reply, I did check src-gen/java and @NotNull attribute was not there. But still, the change is not reflected in DB. I would like to modify DB directly using a query only as the last solution

regards
Richard

Hi @Rich1990 ,
I noticed that when a column already exists, the system cannot modify the attributes of this column?!
If you are in a test database and the data is not to be migrated, have fun deleting the column concerned.
Then, stop the application and when the application is restarted, the column will be created automatically without the NOT NULL.
Regards

1 « J'aime »