function upgrade($old_version) { $q = new DBQuery(); switch ($old_version) { case '0.1': $q->alterTable('history'); $q->addField('history_table', 'varchar(15) NOT NULL default \'\''); $q->addField('history_action', 'varchar(10) NOT NULL default \'modify\''); $q->dropField('history_module'); $q->exec(); $q->clear(); case '0.2': $q->alterTable('history'); $q->addField('history_item', 'int(10) NOT NULL'); $q->exec(); $q->clear(); case '0.3': $q->alterTable('history'); $q->addIndex('index_history_item', '(history_item)'); $q->exec(); $q->clear(); $q->alterTable('history'); $q->addIndex('index_history_module', '(history_table, history_item)'); $q->exec(); $q->clear(); case '0.31': break; } return db_error(); }
public function upgrade($old_version) { $q = new DBQuery(); switch ($old_version) { case '0.3': $q->alterTable('history'); $q->addIndex('index_history_item', '(history_item)'); $q->exec(); $q->clear(); $q->alterTable('history'); $q->addIndex('index_history_module', '(history_table, history_item)'); $q->exec(); $q->clear(); case '0.31': $q->alterTable('history'); $q->alterField('history_table', 'varchar(20) NOT NULL default ""'); $q->alterField('history_action', 'varchar(20) NOT NULL default "modify"'); $q->exec(); $q->clear(); case '0.32': break; } return db_error() ? false : true; }