Does grails have an automatic constraint update. If we change the field in domain class to be nullable by adding constraint, it is not getting reflected in database without schema export. Is it possible to do get grails do this update automatically.
Does grails have an automatic constraint update. If we change the field in domain
Share
No, Grails/Hibernate won’t automatically update your DB schema (except from simple cases like adding a new attribute), because this is no task that can be reliably automated (especially with changed data types or constraints). What would Hibernate be supposed to do with existing data, if you change the data type of a property from String to int?
So, this stuff has to be done manually. However, there is tool support for this, namely the Autobase plugin, which is based on liquibase. If you have ever developed with RoR you might be familiar with migrations – that’s essentially what autobase is providing. I can definitely recommend autobase/liquibase, we are using it in all our production projects.