3 // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
5 // IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
6 // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
8 function chat_upgrade($oldversion) {
9 // This function does anything necessary to upgrade
10 // older versions to match current functionality
14 if ($oldversion < 2003072100) {
15 modify_database ("", " INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); ");
18 if ($oldversion < 2003072101) {
19 table_column("chat", "messages", "keepdays", "integer", "10", "unsigned", "0", "not null");
22 if ($oldversion < 2003072102) {
23 table_column("chat", "", "studentlogs", "integer", "4", "unsigned", "0", "not null", "keepdays");
26 if ($oldversion < 2003072500) {
27 table_column("chat", "", "chattime", "integer", "10", "unsigned", "0", "not null", "studentlogs");
28 table_column("chat", "", "schedule", "integer", "4", "", "0", "not null", "studentlogs");
31 if ($oldversion < 2004022300) {
32 table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
33 table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
36 if ($oldversion < 2004042500) {
37 include_once("$CFG->dirroot/mod/chat/lib.php");
38 chat_refresh_events();
41 if ($oldversion < 2004043000) {
42 modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
45 if ($oldversion < 2004111200) {
46 execute_sql("ALTER TABLE {$CFG->prefix}chat DROP INDEX `course`;",false);
47 execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `chatid`;",false);
48 execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `userid`;",false);
49 execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `groupid`;",false);
50 execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX `chatid`;",false);
51 execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX `groupid`;",false);
53 modify_database('','ALTER TABLE prefix_chat ADD INDEX `course` (`course`);');
54 modify_database('','ALTER TABLE prefix_chat_messages ADD INDEX `chatid` (`chatid`);');
55 modify_database('','ALTER TABLE prefix_chat_messages ADD INDEX `userid` (`userid`);');
56 modify_database('','ALTER TABLE prefix_chat_messages ADD INDEX `groupid` (`groupid`);');
57 modify_database('','ALTER TABLE prefix_chat_users ADD INDEX `chatid` (`chatid`);');
58 modify_database('','ALTER TABLE prefix_chat_users ADD INDEX `groupid` (`groupid`);');
61 if ($oldversion < 2005020300) {
62 table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
63 table_column('chat_users', '', 'lang' , 'varchar', '10', '' , '' , 'not null', '');
66 ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.