You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SoftDeletesMixin doesn't work as expected when trying to change the column name.
When we try to add __deleted_at__ = 'archived_at' to the Model class, it changes the value of deleted_at field on the class but it is not used later when creating a query. I think the reason is this in masoniteorm.models.Model, method boot, this line:
if class_name.endswith("Mixin"):
getattr(base_class(), "boot_" + class_name)(self.builder)
because it doesn't use previously changed mixin, but creates a new one.
I think it can be solved like this:
if class_name.endswith("Mixin"):
getattr(self, "boot_" + class_name)(self.builder)
but i am not sure if it will break some other mixin.
Can you please tell me if this change is safe to add, and I will create a PR if it is. If not, do you have some other solution to my problem?
Desktop:
OS: Linux
Version Ubuntu 21.10
What database are you using?
Type: [MySQL]
Version [14.14 Distrib 5.7.30, for Linux (x86_64) using EditLine wrapper]
Masonite ORM [2.4.2]
The text was updated successfully, but these errors were encountered:
@Marlysson I did and exactly this is the problem because boot method in Model class creates a new instance of the SoftDeletesMixin that doesn't contain my change but only hardcoded value. Okay, I'll try tomorrow :)
SoftDeletesMixin doesn't work as expected when trying to change the column name.
When we try to add
__deleted_at__ = 'archived_at'
to the Model class, it changes the value of deleted_at field on the class but it is not used later when creating a query. I think the reason is this in masoniteorm.models.Model, method boot, this line:because it doesn't use previously changed mixin, but creates a new one.
I think it can be solved like this:
but i am not sure if it will break some other mixin.
Can you please tell me if this change is safe to add, and I will create a PR if it is. If not, do you have some other solution to my problem?
Desktop:
What database are you using?
The text was updated successfully, but these errors were encountered: