Cleaned up a bit
[moodle.git] / version.php
CommitLineData
cbd1170e 1<?PHP //$Id$
2// This file keeps track of upgrades to Moodle.
3//
4// Sometimes, changes between versions involve
5// alterations to database structures and other
6// major things that may break installations.
7//
8// This file specifies the current version of
9// Moodle installed, which can be compared against
10// a previous version (see the "config" table).
11//
12// To do this, visit the "admin" page.
13//
14// The upgrade function in this file will attempt
15// to perform all the necessary actions to upgrade
16// your older databases to the current version.
17// If there's something it cannot do itself, it
18// will tell you what you need to do.
19
19967d6c 20$version = 2002090501;
cbd1170e 21
a8876884 22function upgrade_moodle($oldversion=0) {
cbd1170e 23
a8876884 24 if ($oldversion == 0) {
25 execute_sql("
26 CREATE TABLE `config` (
27 `id` int(10) unsigned NOT NULL auto_increment,
28 `name` varchar(255) NOT NULL default '',
29 `value` varchar(255) NOT NULL default '',
30 PRIMARY KEY (`id`),
31 UNIQUE KEY `name` (`name`)
501cdbd8 32 ) COMMENT='Moodle configuration variables';");
a8876884 33 notify("Created a new table 'config' to hold configuration data");
34 }
35
501cdbd8 36 if ($oldversion < 2002073100) {
7363ff91 37 execute_sql(" DELETE FROM `modules` WHERE `name` = 'chat' ");
a8876884 38 }
501cdbd8 39
7ea53a1f 40 if ($oldversion < 2002080200) {
41 execute_sql(" ALTER TABLE `modules` DROP `fullname` ");
42 execute_sql(" ALTER TABLE `modules` DROP `search` ");
43 }
44
565f7a95 45 if ($oldversion < 2002080300) {
7363ff91 46 execute_sql(" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL ");
47 execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL ");
48 }
49
50 if ($oldversion < 2002082100) {
51 execute_sql(" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL ");
565f7a95 52 }
53
55e078c0 54 if ($oldversion < 2002082101) {
7b1c0ce3 55 execute_sql(" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` ");
56 }
57 if ($oldversion < 2002090100) {
58 execute_sql(" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL ");
55e078c0 59 }
60
cbd1170e 61 return true;
62}
63
64?>