Skip to content

Commit 6bee5a4

Browse files
committed
null db migration
1 parent b55a570 commit 6bee5a4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/db/schema/ddl/ddl.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ func FromStatement(stmt *gorm.Statement) Table {
133133
if field.FieldType.Kind() == reflect.Ptr {
134134
if _, ok := field.TagSettings["NOT NULL"]; !ok {
135135
column.Nullable = true
136-
if field.DefaultValue == "" {
137-
field.DefaultValue = "NULL"
136+
if column.Type == "TIMESTAMP" && column.Default == "0000-00-00 00:00:00" {
137+
column.Default = "NULL"
138+
}
139+
if column.Default == "" {
140+
column.Default = "NULL"
138141
}
139142
}
140143
}

0 commit comments

Comments
 (0)