diff --git a/lib/db/schema/ddl/ddl.go b/lib/db/schema/ddl/ddl.go index 1ab6fac5..149037f7 100644 --- a/lib/db/schema/ddl/ddl.go +++ b/lib/db/schema/ddl/ddl.go @@ -133,8 +133,11 @@ func FromStatement(stmt *gorm.Statement) Table { if field.FieldType.Kind() == reflect.Ptr { if _, ok := field.TagSettings["NOT NULL"]; !ok { column.Nullable = true - if field.DefaultValue == "" { - field.DefaultValue = "NULL" + if column.Type == "TIMESTAMP" && column.Default == "0000-00-00 00:00:00" { + column.Default = "NULL" + } + if column.Default == "" { + column.Default = "NULL" } } }