From 6ee3a97751cad61b2107c51ec34c346d3e55a912 Mon Sep 17 00:00:00 2001 From: Horacio Duran Date: Fri, 15 Sep 2017 19:07:07 -0300 Subject: [PATCH] Correct ModifyColumn SQL syntax. The generated SQL for ModifyColumn was: `ALTER TABLE "tablename" MODIFY "columname" type` But should have been: `ALTER TABLE "tablename" ALTER COLUMN "columname" TYPE type` since Modify does not seem to be entirely compatible with all Engines --- scope.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.go b/scope.go index fda7f653..51ebd5a0 100644 --- a/scope.go +++ b/scope.go @@ -1139,7 +1139,7 @@ func (scope *Scope) dropTable() *Scope { } func (scope *Scope) modifyColumn(column string, typ string) { - scope.Raw(fmt.Sprintf("ALTER TABLE %v MODIFY %v %v", scope.QuotedTableName(), scope.Quote(column), typ)).Exec() + scope.Raw(fmt.Sprintf("ALTER TABLE %v ALTER COLUMN %v TYPE %v", scope.QuotedTableName(), scope.Quote(column), typ)).Exec() } func (scope *Scope) dropColumn(column string) {