This commit is contained in:
Jerry 2020-03-10 19:08:31 +08:00
parent 52fdd747b8
commit 5da946601c
1 changed files with 3 additions and 8 deletions

View File

@ -286,16 +286,11 @@ func (engine *Engine) loadTableInfo(table *schemas.Table) error {
var seq int
for _, index := range indexes {
for _, name := range index.Cols {
parts := strings.Split(name, " ")
if len(parts) > 1 {
if parts[1] == "DESC" {
seq = 1
}
}
if col := table.GetColumn(parts[0]); col != nil {
seq++
if col := table.GetColumn(name); col != nil {
col.Indexes[index.Name] = index.Type
} else {
return fmt.Errorf("Unknown col %s seq %d, in index %v of table %v, columns %v", name, seq, index.Name, table.Name, table.ColumnsSeq())
return fmt.Errorf("Unknown col %s seq %d, in index %s of table %s, columns %v", name, seq, index.Name, table.Name, table.ColumnsSeq())
}
}
}