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
This commit is contained in:
Horacio Duran 2017-09-15 19:07:07 -03:00
parent b1885a643b
commit 6ee3a97751

View File

@ -1139,7 +1139,7 @@ func (scope *Scope) dropTable() *Scope {
} }
func (scope *Scope) modifyColumn(column string, typ string) { 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) { func (scope *Scope) dropColumn(column string) {