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.

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top