nodeIndexTableDef handles *tree.IndexTableDef nodes. The parser does not store type information in the index definition (PRIMARY KEY, UNIQUE, etc.) so it must be added to this definition by the caller.
(ctx *Context, node *tree.IndexTableDef)
| 26 | // nodeIndexTableDef handles *tree.IndexTableDef nodes. The parser does not store type information in the index |
| 27 | // definition (PRIMARY KEY, UNIQUE, etc.) so it must be added to this definition by the caller. |
| 28 | func nodeIndexTableDef(ctx *Context, node *tree.IndexTableDef) (*vitess.IndexDefinition, error) { |
| 29 | if node == nil { |
| 30 | return nil, nil |
| 31 | } |
| 32 | if node.IndexParams.IncludeColumns != nil { |
| 33 | return nil, errors.Errorf("include columns is not yet supported") |
| 34 | } |
| 35 | if len(node.IndexParams.StorageParams) > 0 { |
| 36 | logrus.Warn("storage params are not yet supported, ignoring") |
| 37 | } |
| 38 | if node.IndexParams.Tablespace != "" { |
| 39 | logrus.Warn("tablespace is not yet supported, ignoring") |
| 40 | } |
| 41 | |
| 42 | indexFields, err := nodeIndexElemList(ctx, node.Columns) |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | |
| 47 | return &vitess.IndexDefinition{ |
| 48 | Info: &vitess.IndexInfo{ |
| 49 | Type: "", |
| 50 | Name: vitess.NewColIdent(string(node.Name)), |
| 51 | }, |
| 52 | Fields: indexFields, |
| 53 | }, nil |
| 54 | } |
no test coverage detected