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

klesh pushed a commit to branch kw-7852-components-field-length
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 372ea3ebea2ffdb1a9d78a19db3d0ef39bf47c59
Author: Klesh Wong <[email protected]>
AuthorDate: Tue Aug 13 15:33:54 2024 +0800

    fix: column type should not be parameterized
---
 backend/impls/dalgorm/dalgorm.go | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/backend/impls/dalgorm/dalgorm.go b/backend/impls/dalgorm/dalgorm.go
index 7812d94dc..70d48e2bd 100644
--- a/backend/impls/dalgorm/dalgorm.go
+++ b/backend/impls/dalgorm/dalgorm.go
@@ -379,15 +379,14 @@ func (d *Dalgorm) ModifyColumnType(table, columnName, 
columnType string) errors.
        defer func() {
                _ = d.Exec("SELECT * FROM ? LIMIT 1", clause.Table{Name: table})
        }()
-       sql := "ALTER TABLE ? MODIFY COLUMN ? ?"
+       sql := "ALTER TABLE ? MODIFY COLUMN ? %s"
        if d.db.Dialector.Name() == "postgres" {
-               sql = "ALTER TABLE ? ALTER COLUMN ? TYPE ?"
+               sql = "ALTER TABLE ? ALTER COLUMN ? TYPE %s"
        }
        return d.Exec(
-               sql,
+               fmt.Sprintf(sql, columnType),
                clause.Table{Name: table},
                clause.Column{Name: columnName},
-               clause.Column{Name: columnType},
        )
 }
 

Reply via email to