Skip to content

Soft deletes failing without updated_at column #19620

Closed
@mcblum

Description

@mcblum
  • Laravel Version: 5.4.26
  • PHP Version: 7.1
  • Database Driver & Version: MySql 5.7

Description:

After updating to 5.4.26 one test began failing because we don't have timestamps in the table in which we are soft deleting. Appears to be because of:

  protected function runSoftDelete()
    {
        $query = $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey());

        $time = $this->freshTimestamp();

        $this->{$this->getDeletedAtColumn()} = $time;
        $this->{$this->getUpdatedAtColumn()} = $time;

        $query->update([
            $this->getDeletedAtColumn() => $this->fromDateTime($time),
            $this->getUpdatedAtColumn() => $this->fromDateTime($time),
        ]);
    }

Steps To Reproduce:

  • Create a table with no timestamps but soft deletes
  • Try to soft delete something

Thanks all!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions