Welcome Guest, Not a member yet? Register   Sign In
ON DELETE CASCADE for Foreign Keys
#1
Question 

Hello fam,
I want to know what would happen to rows that have soft_deletes set to true in the model.
Does it set the child rows deleted_at colum to null or it deletes all rows regardless?
Reply
#2

From the documentation:

If true, then any delete() method calls will set deleted_at in the database, instead of actually deleting the row. This can preserve data when it might be referenced elsewhere, or can maintain a “recycle bin” of objects that can be restored, or even simply preserve it as part of a security trail. If true, the find*() methods will only return non-deleted rows, unless the withDeleted() method is called prior to calling the find*() method.

https://codeigniter4.github.io/userguide...your-model
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#3

If I understand you, if the soft deletes is set to true AND ON Delete is CASCADE, records will still be kept.
Reply
#4

When it comes to using soft deletes and CASCADE, that I don't know. You'll have to wait for a dev to reply.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#5

It would be nice if someone from the dev team could answer this. @kenjis @includebeer any thoughts on this?
Reply
#6

Quote:The CodeIgniter’s Model provides convenience features and additional functionality that people commonly use to make working with a single table in your database more convenient.

https://codeigniter4.github.io/CodeIgnit...model.html

It does nothing to CASCADE or child tables.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB