0

我想将“dbversion”记录存储在“设置”表中,初始值为 100。

public create_update_db() {
  // dbversion: 101
  // I want to dbversion value in settings table here. 
  If (value < 101) {
    -> add, alter table or somethings else about dabase;
    -> set dbversion value as 101
  }
  If (value < 102) {
    -> add, alter table or somethings else about dabase;
    -> set dbversion value as 102
  }

 // Every new db updates that I need, I'll add new lines here. 
 // And controlled all database with codes in CakePHP 

}

我只需要在哪里使用“create_update_db”程序?在 App_contraller 中?或者在哪里。此过程必须在任何页面加载之前调用...

4

1 回答 1

0

我相信您正在寻找模式管理:http ://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

于 2013-09-05T20:12:40.070 回答