CodeIgniter Forums

Full Version: ALERT: Model soft deletes have changed the underlying data structure
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A heads up for any developers working on a CI4 codebase. I just merged in a breaking change to the way soft deletes work. Instead of being a simple boolean flag called deleted, the default field has been changed to a new column called deleted_at. This should be either a DATETIME or INTEGER column that matches what that table is using for created_at and updated_at.

This not only brings it in line with the other timestamps across the Model and Entities, but provides a better chance for data forensics on the case something gets deleted so you can help your client figure out what might have caused things to go missing.

I have been thinking about this change for a while now, as I'm not really sure why I originally created it as a boolean. Probably an artifact from examining several MY_Model classes that were popular from previous versions of CI. If that change was ever going to happen, it had to happen prior to a Release Candidate.

I know this will likely cause some headaches for people that have already started projects on CI4 beta, but this is the last expected breaking change prior to a RC (which is close!).
Thanks for the update Lonnie.