fix(restore): check if we're really dealing with a string

This commit is contained in:
kolaente 2022-12-02 14:49:29 +01:00
parent 8ae062a095
commit b8c3b570a4
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 1 deletions

View File

@ -77,7 +77,8 @@ func Restore(table string, contents []map[string]interface{}) (err error) {
// users being scheduled for deletion after a restore.
// To avoid this, we set these dates to nil so that they'll end up as null in the db.
col := metaForCurrentTable.GetColumn(colName)
if col.SQLType.IsTime() && (value.(string) == "" || strings.HasPrefix(value.(string), "0001-")) {
strVal, is := value.(string)
if is && col.SQLType.IsTime() && (strVal == "" || strings.HasPrefix(strVal, "0001-")) {
content[colName] = nil
}
}