(namespace string, table *metaCom.Table)
| 178 | } |
| 179 | |
| 180 | func (m *tableSchemaMutator) deleteEnum(namespace string, table *metaCom.Table) { |
| 181 | logger := m.logger.With("namespace", namespace, "table", table.Name, "incarnation", table.Incarnation) |
| 182 | for columnID, column := range table.Columns { |
| 183 | if column.IsEnumColumn() { |
| 184 | value, err := m.txnStore.Get(utils.EnumNodeListKey(namespace, table.Name, table.Incarnation, columnID)) |
| 185 | if err != nil { |
| 186 | logger.With("column", column.Name, "columnID", columnID, "error", err.Error()).Error("failed to get enum node list") |
| 187 | continue |
| 188 | } |
| 189 | var nodeList pb.EnumNodeList |
| 190 | err = value.Unmarshal(&nodeList) |
| 191 | if err != nil { |
| 192 | logger.With("column", column.Name, "columnID", columnID, "error", err.Error()).Error("failed to get enum node list") |
| 193 | continue |
| 194 | } |
| 195 | for nodeID := 0; nodeID < int(nodeList.NumEnumNodes); nodeID++ { |
| 196 | _, err = m.txnStore.Delete(utils.EnumNodeKey(namespace, table.Name, table.Incarnation, columnID, nodeID)) |
| 197 | if err != nil { |
| 198 | logger.With("column", column.Name, "columnID", columnID, "node", nodeID, "error", err.Error()).Error("failed to delete enum node") |
| 199 | continue |
| 200 | } |
| 201 | } |
| 202 | _, err = m.txnStore.Delete(utils.EnumNodeListKey(namespace, table.Name, table.Incarnation, columnID)) |
| 203 | if err != nil { |
| 204 | logger.With("column", column.Name, "columnID", columnID, "error", err.Error()).Error("failed to delete enum node list") |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | func (m *tableSchemaMutator) UpdateTable(namespace string, table metaCom.Table, force bool) (err error) { |
| 211 | tableListProto, tableListVersion, err := readEntityList(m.txnStore, utils.SchemaListKey(namespace)) |
no test coverage detected