Skip to main content

destroying

To destroy a model, simply call the #destroy method on the instance.

import User from 'app/models/user'

const user = await User.first()
await user.destroy()

Destroying can also be done from the query builder for bulk deletion (though it should be known, this will not trigger model hooks like BeforeSave, AfterCreate, etc...).

await user.update({ email: 'how@yadoin.biz' })
import User from 'app/models/user'
import { ops } from 'psychic'

await User.where({ email: ops.like('%y@%') }).destroy()