Fix bug
This commit is contained in:
parent
140ee90928
commit
5b41d53f25
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
"xorm.io/xorm/schemas"
|
"xorm.io/xorm/schemas"
|
||||||
|
@ -196,19 +197,13 @@ func (m *Migrate) createMigrationTableIfNotExists() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
idCol := schemas.Column{
|
idCol := schemas.NewColumn(m.options.IDColumnName, "", schemas.SQLType{
|
||||||
Name: m.options.IDColumnName,
|
|
||||||
SQLType: schemas.SQLType{
|
|
||||||
Name: "VARCHAR",
|
Name: "VARCHAR",
|
||||||
DefaultLength: 255,
|
}, 255, 0, true)
|
||||||
},
|
idCol.IsPrimaryKey = true
|
||||||
IsPrimaryKey: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
table := &schemas.Table{
|
table := schemas.NewTable(m.options.TableName, reflect.TypeOf(new(schemas.Table)))
|
||||||
Name: m.options.TableName,
|
table.AddColumn(idCol)
|
||||||
}
|
|
||||||
table.AddColumn(&idCol)
|
|
||||||
|
|
||||||
sql, _, err := m.db.Dialect().CreateTableSQL(context.Background(), m.db.DB(), table, m.options.TableName)
|
sql, _, err := m.db.Dialect().CreateTableSQL(context.Background(), m.db.DB(), table, m.options.TableName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue