I want to store "dbversion" record in "settings" table with initial value is 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
}
All I need where do I use "create_update_db" procedure? In App_contraller? Or where. This procedure have to call before any page loading...
I believe you’re looking for schema management: http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html