This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new c4cef5cbd fix: fix nil function error (#4750)
c4cef5cbd is described below

commit c4cef5cbd0a1c352fdc97757b1a7a5bc31904565
Author: mappjzc <[email protected]>
AuthorDate: Fri Mar 24 17:03:42 2023 +0800

    fix: fix nil function error (#4750)
    
    Fix the ChangeColumnsType error with no where.
    
    Nddtfjiang <[email protected]>
---
 backend/helpers/migrationhelper/migrationhelper.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/backend/helpers/migrationhelper/migrationhelper.go 
b/backend/helpers/migrationhelper/migrationhelper.go
index 5999f26d9..cb89e8fac 100644
--- a/backend/helpers/migrationhelper/migrationhelper.go
+++ b/backend/helpers/migrationhelper/migrationhelper.go
@@ -21,13 +21,14 @@ import (
        "crypto/md5"
        "encoding/hex"
        "fmt"
+       "reflect"
+       "strings"
+
        "github.com/apache/incubator-devlake/core/context"
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/core/plugin"
        helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-       "reflect"
-       "strings"
 )
 
 // AutoMigrateTables runs AutoMigrate for muliple tables
@@ -89,12 +90,13 @@ func ChangeColumnsType[D any](
                for i, v := range columns {
                        dalSet = append(dalSet, dal.DalSet{
                                ColumnName: v,
-                               Value:      dal.ClauseColumn{Name: 
tmpColumnsNames[i]},
+                               Value:      tmpColumnsNames[i],
                        })
                }
                err = db.UpdateColumns(
                        new(D),
                        dalSet,
+                       dal.Where("1=1"),
                )
        } else {
                params := make([]interface{}, 0, len(tmpColumnsNames))

Reply via email to