This commit is contained in:
CyJaySong 2023-10-28 16:09:58 +08:00
parent 85502d4779
commit d3926afde6
2 changed files with 7 additions and 2 deletions

View File

@ -18,9 +18,12 @@ func FormatColumnTime(dialect Dialect, dbLocation *time.Location, col *schemas.C
if col.Nullable { if col.Nullable {
return nil, nil return nil, nil
} }
if col.SQLType.IsNumeric() || col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz { if col.SQLType.IsNumeric() {
return 0, nil return 0, nil
} }
if col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz {
t = time.Unix(0, 0)
}
} }
tmZone := dbLocation tmZone := dbLocation

View File

@ -704,8 +704,10 @@ func (statement *Statement) CondDeleted(col *schemas.Column) builder.Cond {
colName = statement.quote(prefix) + "." + statement.quote(col.Name) colName = statement.quote(prefix) + "." + statement.quote(col.Name)
} }
cond := builder.NewCond() cond := builder.NewCond()
if col.SQLType.IsNumeric() || col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz { if col.SQLType.IsNumeric() {
cond = builder.Eq{colName: 0} cond = builder.Eq{colName: 0}
} else if col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz {
cond = builder.Eq{colName: time.Unix(0, 0).In(statement.defaultTimeZone).Format("2006-01-02 15:04:05.999999999")}
} else { } else {
cond = builder.Eq{colName: utils.ZeroTime1} cond = builder.Eq{colName: utils.ZeroTime1}
} }