Skip to content

Commit

Permalink
Allow empty values for because of isnull and isnotnull (#4078)
Browse files Browse the repository at this point in the history
* Allow empty values for because of isnull and isnotnull
* Add float64 to the values just passed through
  • Loading branch information
yoshnopa authored Sep 1, 2023
1 parent c364346 commit c38e05c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/sqlite/migrations/49_postmigrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ func (m *schema49Migrator) adjustCriterionValue(value interface{}, typ string) (
return value, nil
} else if _, ok := value.(int); ok {
return value, nil
} else if _, ok := value.(float64); ok {
return value, nil
}

return nil, fmt.Errorf("could not recognize format of value %v", value)
Expand Down Expand Up @@ -392,7 +394,7 @@ func (m *schema49Migrator) adjustCriterionItem(value interface{}) (interface{},
// Converts a value of type string to its according type, given by string
func (m *schema49Migrator) convertValue(value interface{}, typ string) (interface{}, error) {
valueType := reflect.TypeOf(value).Name()
if typ == valueType || (typ == "int" && valueType == "float64") || (typ == "float64" && valueType == "int") {
if typ == valueType || (typ == "int" && valueType == "float64") || (typ == "float64" && valueType == "int") || value == "" {
return value, nil
}

Expand Down

0 comments on commit c38e05c

Please sign in to comment.