Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway I can physically delete a row even if the model is set to softdelete? #246

Open
tonyzhangcn opened this issue Jul 4, 2018 · 3 comments
Assignees
Labels

Comments

@tonyzhangcn
Copy link

Hi,
I have a model which inherited from SoftDelete, in most cases I need it to be soft delete but in some rare cases I need it to be deleted physically, I tried the force_delete() but it worked the same as delete, not solving my problem. Any idea is appreciated!

@josephmancuso
Copy link
Collaborator

force delete should delete it permanently for your use case. I'll test this out sometime today or tomorrow and verify that it's working properly

@josephmancuso josephmancuso self-assigned this Jul 4, 2018
@tonyzhangcn
Copy link
Author

Thanks for the quick reply!

@mouday
Copy link

mouday commented Dec 10, 2019

soft delete not work


class User(SoftDeletes, Model):

    # 设置真正的表名
    __table__ = 'student'

    # 禁用时间自动更新 created_at updated_at
    __timestamps__ = False

    # 继承 SoftDeletes 使用软删除
    __dates__ = ['deleted_at']



User.where('id', '=', 19).delete()
'DELETE FROM `student` WHERE `id` = 19'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants