Open jo-elimu opened 3 weeks ago
@jo-elimu So, do we need to add null constraints to the model classes according to this file https://github.com/elimu-ai/webapp/blob/main/src/main/resources/META-INF/jpa-schema-export.sql
@jo-elimu So, do we need to add null constraints to the model classes according to this file https://github.com/elimu-ai/webapp/blob/main/src/main/resources/META-INF/jpa-schema-export.sql
@venkatesh2k3 No, because we want not null
to be applied implicitly to the DDL whenever a property is annotated with @NotNull
, which they are in many classes already.
I don't know when and why this stopped working, but I suspect it has to do with the dependency versions we use. We also made the switch from MySQL to MariaDB a few years ago, so maybe we should replace the usage of MySQL in our DB configuration as well.
We are currently running MariaDB 11.4.2 in production: https://github.com/elimu-ai/webapp/blob/main/src/main/config/DEPLOY.md
Possibly related: https://stackoverflow.com/a/51734560
The JPA schema export at https://github.com/elimu-ai/webapp/blob/main/src/main/resources/META-INF/jpa-schema-export.sql should apply
not null
when an entity's property is annotated with@NotNull
.https://stackoverflow.com/questions/51258073/notnull-annotation-does-not-translate-to-not-null-constraint-in-schema-generati
Make changes so that
@NotNull
automatically addsnot null
to the database layer (DDL + production database).Relates to #1286, #1607