Question

I'm in the middle of building CMS/CRM for my company using CodeIgniter and I need a way to add deleted items to a trash queue.

So how would you approach the problem of removing a record on delete and placing it in another table? I would also require a way to re-instate the record from the trash queue.

Any thoughts on this would be very much welcomed. Thanks.

Was it helpful?

Solution

I would just use a column on your table called deleted TINYINT(1) That way you could just flag it as being deleted and you don't need to move it to any other table. So you would just update the record instead of deleting it. UPDATE table_name SET deleted = 1 WHERE id = 1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top