RenameRootObject implements the interface objinterface.Collection.
(ctx context.Context, oldName id.Id, newName id.Id)
| 322 | |
| 323 | // RenameRootObject implements the interface objinterface.Collection. |
| 324 | func (pgs *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error { |
| 325 | if !oldName.IsValid() || !newName.IsValid() || oldName.Section() != newName.Section() || oldName.Section() != id.Section_Sequence { |
| 326 | return errors.New("cannot rename sequence due to invalid name") |
| 327 | } |
| 328 | oldSeqName := id.Sequence(oldName) |
| 329 | newSeqName := id.Sequence(newName) |
| 330 | seq, err := pgs.GetSequence(ctx, oldSeqName) |
| 331 | if err != nil { |
| 332 | return err |
| 333 | } |
| 334 | if err = pgs.DropSequence(ctx, oldSeqName); err != nil { |
| 335 | return err |
| 336 | } |
| 337 | newSeq := *seq |
| 338 | newSeq.Id = newSeqName |
| 339 | return pgs.CreateSequence(ctx, &newSeq) |
| 340 | } |
| 341 | |
| 342 | // ResolveName implements the interface objinterface.Collection. |
| 343 | func (pgs *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error) { |
nothing calls this directly
no test coverage detected