function do_updates() { // ALL DATABASE UPDATES GO IN HERE! // FOR EACH SQL STATEMENT YOU WANT TO EXECUTE, GIVE IT A 'KEY', THEN CALL: // $this->qup("key", "sql statement"); // eg. $this->qup("new foobar table", "create table foobar (id int not null, primary key(id))"); // YOU SHOULD NORMALLY PUT YOUR UPDATES AT THE *END* OF THIS FUNCTION. /** NOTE: KEY must be unique for each update query */ /** EXAMPLE ADD NEW TABLE */ /* $this->qup("new mc_feeds table", "CREATE TABLE mc_feeds ( user_id int not null, id int not null auto_increment, primary key(user_id,id), feed_url text not null, feed_name varchar(255) )"); */ /** EXAMPLE ALTER TABLE */ // $this->qup("add feed_description to mc_feeds", "ALTER TABLE mc_feeds ADD COLUMN feed_description TEXT"); /** EXAMPLE INSERT INTO TABLE */ // $this->qup("insert default data 1 for relation classifications", "INSERT INTO `relation_classifications` (`relation_type`, `relation_type_id`) VALUES ('acquaintance', '1');"); /** EXAMPLE UPDATE TABLE */ // $this->qup("changed id field in review-type movie", "UPDATE review_type SET review_id = 1 WHERE review_name = 'Movie'"); // finally, run the 'safe' updates in net_extra.php. $child_role = array('id' => 9, 'name' => 'Child', 'description' => 'Role for family members with Child status', 'read_only' => 1, 'type' => 'group', 'tasks' => array(12, 13, 15, 16, 22, 30)); $this->qup_all_networks("2009-09-28, by: Zoran Hron - adding Child role, ID: " . $child_role['id'], "INSERT INTO {roles} (id, name, description, created, changed, read_only, type)\n VALUES (" . $child_role['id'] . ", '" . $child_role['name'] . "', '" . $child_role['description'] . "', " . time() . ", " . time() . ", " . $child_role['read_only'] . ", '" . $child_role['type'] . "')\n ON DUPLICATE KEY UPDATE name = '" . $child_role['name'] . "', description = '" . $child_role['description'] . "', read_only = " . $child_role['read_only'] . ", type = '" . $child_role['type'] . "'"); foreach ($child_role['tasks'] as $task_id) { $this->qup_all_networks("2009-09-28, by: Zoran Hron - adding tasks/permissions for Child role. ID=" . $child_role['id'] . ", task ID=" . $task_id, "INSERT IGNORE INTO {tasks_roles} (`task_id`, `role_id`) VALUES (" . $task_id . ", " . $child_role['id'] . ");"); } require_once 'api/Contribution/Contribution.php'; if (!Contribution::table_exists()) { $this->qup('2010-11-19, by: Jonathan Knapp - adding cc_contributions table to database', "CREATE TABLE `cc_contributions` ( `content_id` INT NOT NULL , `contribution_id` INT NOT NULL , `type` ENUM('issue','conversation') NOT NULL , `title` TEXT , PRIMARY KEY (`content_id`) );"); } $this->run_xml_updates(); run_net_extra(); }