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

Fix: Deletion timestamp of the Model is updated when a record that has been soft-deleted is deleted again #5578

Merged
merged 3 commits into from
Jan 21, 2022

Conversation

iRedds
Copy link
Collaborator

@iRedds iRedds commented Jan 15, 2022

Description
Related #5576
If the model provides for soft deletion of records and an attempt is made to re-delete, then timestamps are changed in the record marked as deleted.

This PR adds a condition under which the update will only occur if the deletion timestamp has not yet been set.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added tests needed Pull requests that need tests bug Verified issues on the current code behavior or pull requests that will fix them labels Jan 15, 2022
@kenjis
Copy link
Member

kenjis commented Jan 20, 2022

Can you add test case to prove the code works?

Note, we expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works.
https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#unit-testing

@iRedds
Copy link
Collaborator Author

iRedds commented Jan 20, 2022

@kenjis Of all the model tests, I found only life tests.
I don't know if this will be enough.

@kenjis
Copy link
Member

kenjis commented Jan 20, 2022

@iRedds This is a bug fix. So the workflow is like this:

  1. write a test which reproduces the bug, and confirm it fails.
  2. fix the bug, and confirm the test passes.

I think your test is enough.

@kenjis kenjis removed the tests needed Pull requests that need tests label Jan 20, 2022
@kenjis kenjis changed the title Fix: Model. Changing the timestamps of a soft deleted row. Fix: Deletion timestamp of the Model is updated when a record that has been soft-deleted is deleted again Jan 20, 2022
@kenjis kenjis added the database Issues or pull requests that affect the database layer label Jan 20, 2022
@kenjis kenjis merged commit 21c4cca into codeigniter4:develop Jan 21, 2022
@iRedds iRedds deleted the fix/model-delete branch January 21, 2022 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants