adding some strings
[moodle-linuxchix.git] / mod / chat / db / postgres7.php
blobf3b6f0a27e7fa06bf92676168253b7961437fc5a
1 <?php // $Id$
3 // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
4 //
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
12 global $CFG;
14 if ($oldversion < 2004022300) {
15 table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
16 table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
19 if ($oldversion < 2004042500) {
20 include_once("$CFG->dirroot/mod/chat/lib.php");
21 chat_refresh_events();
24 if ($oldversion < 2004043000) {
25 modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
28 if ($oldversion < 2004111200) { //drop them first to avoid collisions with upgrades from 1.4.2+
29 execute_sql("DROP INDEX {$CFG->prefix}chat_course_idx;",false);
30 execute_sql("DROP INDEX {$CFG->prefix}chat_messages_chatid_idx;",false);
31 execute_sql("DROP INDEX {$CFG->prefix}chat_messages_userid_idx;",false);
32 execute_sql("DROP INDEX {$CFG->prefix}chat_messages_groupid_idx;",false);
33 execute_sql("DROP INDEX {$CFG->prefix}chat_messages_timemodifiedchatid_idx;",false);
34 execute_sql("DROP INDEX {$CFG->prefix}chat_users_chatid_idx;",false);
35 execute_sql("DROP INDEX {$CFG->prefix}chat_users_userid_idx;",false);
36 execute_sql("DROP INDEX {$CFG->prefix}chat_users_groupid_idx;",false);
37 execute_sql("DROP INDEX {$CFG->prefix}chat_users_lastping_idx;",false);
39 modify_database('','CREATE INDEX prefix_chat_course_idx ON prefix_chat(course);');
40 modify_database('','CREATE INDEX prefix_chat_messages_chatid_idx ON prefix_chat_messages (chatid);');
41 modify_database('','CREATE INDEX prefix_chat_messages_userid_idx ON prefix_chat_messages (userid);');
42 modify_database('','CREATE INDEX prefix_chat_messages_groupid_idx ON prefix_chat_messages (groupid);');
43 modify_database('','CREATE INDEX prefix_chat_messages_timemodifiedchatid_idx ON prefix_chat_messages(timestamp,chatid);');
44 modify_database('','CREATE INDEX prefix_chat_users_chatid_idx ON prefix_chat_users (chatid);');
45 modify_database('','CREATE INDEX prefix_chat_users_userid_idx ON prefix_chat_users (userid);');
46 modify_database('','CREATE INDEX prefix_chat_users_groupid_idx ON prefix_chat_users (groupid);');
47 modify_database('','CREATE INDEX prefix_chat_users_lastping_idx ON prefix_chat_users (lastping);');
50 if ($oldversion < 2005020300) {
51 table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
52 table_column('chat_users', '', 'lang' , 'varchar', '10', '' , '' , 'not null', '');
55 if ($oldversion < 2005031001) { // Mass cleanup of bad upgrade scripts
56 modify_database('','ALTER TABLE prefix_chat_users ALTER course SET NOT NULL');
57 modify_database('','ALTER TABLE prefix_chat_users ALTER lang SET NOT NULL');
60 ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
62 return true;