radmen / adonis-lucid-soft-deletes

Experimental implementation of soft-deletes for Adonis Lucid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installed the package, but soft deletes addon doesn't seem to be doing anything

Flambe opened this issue · comments

I've run adonis install @radmen/adonis-lucid-soft-deletes added the provider to app.js, added the trait to my model and added deleted_at to my schema, but my application doesn't seem to be loading this addon. E.G. If I get .isTrashed on a model, it's undefined. I can't see any errors anywhere either.

Is it possible that I've missed something while setting this up?

Looks like it was an issue with the way I set up my models.

My model was extending a base model, which then extended the Lucid model. For some reason, this caused the boot method to not run, which resulted in the model not being soft deletable. Making the model extend the Lucid model directly fixed this and it's all working again.