Skip to content

Destroy a record

Anton Demushkin edited this page Aug 4, 2019 · 1 revision

To delete or detach a record you need to get its instance before.

const someTag = await Tag.find(1234);

await someTag.delete();
// or
someTag.detach();

Let's call the Model as Model and the instance of that model as record.

Detach node from tree

Detach the node from the tree by invalidating its left and right values.

record.detach()

Delete node

Delete the node with all its children.

async record.delete(options = {})

Clone this wiki locally