I have a grails 3.3 project with postgres database. I am using Liquibase DB refactoring.
Firstly, there seems to be a bug in grails due to which the migrations don't pick default value constraint from Grails Domain Class. To get over this issue, I had created a custom migration file with this value :
addColumn(tableName: "task") {
column(name: "period", type: "int4", defaultValueNumeric: 0) {
constraints(nullable: "false")
}
}
I achieved my purpose since the new column added had default set to 0. However, Now if i run dbm-gorm-diff for any changes, it adds a dropDefaultValue in migrations (thus trying to undo the manual change I did)
dropDefaultValue(columnDataType: "int", columnName: "period", tableName: "task")
This is problematic since I have to take care of updating migration file each time i run the migration. What is proper fix for this ?