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(); }
function upgrade($old_version) { switch ($old_version) { case "1.0": $q = new DBQuery(); $q->addTable('resources'); $q->addField('resource_key', "varchar(64) not null default ''"); $q->exec(); if (db_error()) { return false; } // FALLTHROUGH // FALLTHROUGH case "1.0.1": break; } return true; }