Askedio/laravel-soft-cascade

MorphMany failure

Opened this issue · 2 comments

  • Laravel version: 8.83.16
  • Laravel Soft Cascade Version: 8.1.0

Description:

I'm using a polymorphic

    public function files(): MorphMany
    {
        return $this->morphMany(File::class, 'files', 'fileable_type', 'fileable_id');
    }

but it seems not to work.

It says

Column not found: 1054 Unknown column 'entry.deleted_at' in 'field list' (SQL: update `files` set `entry`.`deleted_at` = 2024-05-03 14:31:15, `files`.`updated_at` = 2024-05-03 14:31:15 where `id` in (1998334, 1998335, 1998336, 1998337, 1998338, 1998339, 1998340, 1998341, 1998342, 1998343, 1998344, 1998345, 1998346, 1998347, 1998348, 1998349, 1998350, 1998351, 1998352, 1998353, 1998354, 1998355, 1998357, 1998358, 1998359, 1998360, 1998474, 1998475, 1998669, 1998670) limit 30)", message: "Internal server error", extensions: { category: "internal" }, locations: [[Object]], path: ["doEntry"], trace: [[Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], ... 75 more items] }

Entry is the model that includes the trait and Files is the model that needs to be deleted on cascade

I'm seeing this issues here and seems the same

#109
#31

Any help here?

@gcphost @maguilar92 any feedback?

I have a $model->myRelation()->delete() model in myRelation() is the one with softcascade with files table
update my_relation.deleted_at="2023-05-15 12:00:00" not found in files
Somehow it wants to update set my_relation.deleted_at instead of files.deleted_at