Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using hibernate hbm2ddl.auto=update : How can I alter column not to require value anymore?

I had a property that used to be not-null="true". Values aren't necessary for that field anymore so I changed it to not-null="false" but the table does not get updated in the database. Adding new properties doesn't give any problems.

Is it possible for hbm2ddl.auto=update to change the the table automatically to remove the not-null="true"? (I know I can just write a sql script to change it but would like to let it get updated automagically)

like image 659
Wilhelm Kleu Avatar asked Nov 05 '22 21:11

Wilhelm Kleu


1 Answers

From what I could gather: hbm2ddl.auto=update won't change not-null value for tables that already have data in.

In the end I just wrote a sql script to change the table.

like image 71
Wilhelm Kleu Avatar answered Nov 11 '22 05:11

Wilhelm Kleu