Search code examples
postgresqlhibernategrails

is it possible for hibernate to create a column in db with default value if it is declared in the domain class?


I need do add a column in the database with false value for all the records in a table(more than 5 millions rows). I've declared the column in the domain class :boolean isLocked, but when the application starts, I receive this exception: Caused by: org.postgresql.util.PSQLException: ERROR: column isLocked does not exist.

I want to know if I can make hibernate create this column only once with the default value (false for boolean).

I am using grails 3.3.9 version.


Solution

  • What I've done eventually was to create the column in the database by hand, so when starting the app, it will see that the column exists in the db.