我有一個非常簡單的表students,結構如下,其中主鍵是id。該表是大約20個數百萬行表的替代品,它們被大量連接在一起。
+----+----------+------------+
| id | name | dob |
+----+----------+------------+
| 1 | Alice | 01/12/1989 |
| 2 | Bob | 04/06/199
我使用的是軟件刪除 - 來自CakeDC的utils包的行爲。 (https://github.com/CakeDC/utils) 現在的問題是:我想在控制器檢查,如果事情是軟(刪除),像這樣: <?php
if ($this->User->delete($id)) {
$this->Session->setFlash(__('user has been deleted'));
我已經閱讀了很多關於軟刪除和存檔,並看到了所有的優點和缺點。我仍然困惑哪種方法最適合我的情況。我會用文章和評論的概念,看看我是否能解釋它更容易一點 Post -> Comments
Post.all
Outside RSS Feeds -> Post -> Comments
RSSFeed.posts (Return the ones that are deleted or not)
通常使用哪種字段來伴隨軟刪除?任何這些,任何其他? bool IsDeleted // nice because the default value is 0 (no) just in case
date DateDeleted // is this a common one?
date DateCreated // more of a temporal db aspect
date Dat