Core: Model relationships do not follow softdeletes on intersect tables

Created on 27 Jul 2017  路  9Comments  路  Source: adonisjs/core

I was unsure whether this should go in lucid or here, so please forgive me if I got it wrong.

I have a belongsToMany that has an intersect table.

It associates a User as an admin of an Organisation through an intersect table "organisation_admins"

That intersect table has softdeletes enabled, but the relationship returns all results regardless of whether they have been deleted

return this.belongsToMany('App/Model/Organisation','organisation_admins','user_id','organisation_id')

It is easily fixed with the following, but I feel like this should be implicit in the behaviour of belongsToMany?

    return this.belongsToMany('App/Model/Organisation','organisation_admins','user_id','organisation_id').where('deleted_at',null)

Most helpful comment

HI @thetutlage - you said that this should be good to go with 4.0, but i don't see soft deletes in the docs for 4.0. Has it been removed?

All 9 comments

Should be good with 4.0

Closing since no answer from issue reporter.

HI @thetutlage - you said that this should be good to go with 4.0, but i don't see soft deletes in the docs for 4.0. Has it been removed?

Hi, are there news about soft deletes?
@dusbuss could you find anything?

@shinobiwarrior - haven't found anything about it yet

Still waiting for it, there鈥檚 an open issue on the Adonis lucid repo that has been assigned so any updates will be there

Thanks to both of you, I'll subscribe to that issue

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aligoren picture aligoren  路  4Comments

GianCastle picture GianCastle  路  3Comments

begueradj picture begueradj  路  3Comments

amrayoub picture amrayoub  路  4Comments

umaams picture umaams  路  3Comments