php – Codeigniter 關於資料庫管理 forge 類別的使用注意
- 欄位可為 NULL 時,不用指定 default 為 NULL ,否則會出錯。
- 型態為 timestamp ,用來記錄該筆資料的變動時間時,不可指定 default 如
123456'updatetime' => array('type' => 'timestamp',),
會自動產生屬性『on update CURRENT_TIMESTAMP』與預設值是『CURRENT_TIMESTAMP』 - 如果要替欄位加上註解,這在官網中似乎沒提到。可以多添加一個叫做 comment 的屬性:
12345678'content' => array('type' => 'varchar','constraint' => 50,'comment' => '內容' //添加這個)