adding some strings
[moodle-linuxchix.git] / mod / exercise / db / mysql.php
blobd2a0f461b58a986b4768151de7ef3118eab5f16a
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 exercise_upgrade($oldversion) {
9 // This function does anything necessary to upgrade
10 // older versions to match current functionality
12 global $CFG;
14 if ($oldversion < 2003111400) {
15 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD INDEX (`userid`)");
16 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` DROP INDEX `title`");
17 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`submissionid`)");
18 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`userid`)");
19 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_grades` ADD INDEX (`assessmentid`)");
22 if ($oldversion < 2003121000) {
23 execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
26 if ($oldversion < 2004062300) {
27 table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
28 table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
29 execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `teacherweight`");
30 execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
33 if ($oldversion < 2004090200) {
34 table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
35 table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
38 if ($oldversion < 2004091000) {
39 table_column("exercise_assessments","generalcomment","generalcomment","text","","","","NOT NULL");
40 table_column("exercise_assessments","teachercomment","teachercomment","text","","","","NOT NULL");
43 if ($oldversion < 2004100800) {
44 include_once("$CFG->dirroot/mod/exercise/lib.php");
45 exercise_refresh_events();
48 if ($oldversion < 2004111200) {
49 execute_sql("ALTER TABLE {$CFG->prefix}exercise DROP INDEX course;",false);
50 execute_sql("ALTER TABLE {$CFG->prefix}exercise_submissions DROP INDEX exerciseid;",false);
51 execute_sql("ALTER TABLE {$CFG->prefix}exercise_assessments DROP INDEX exerciseid;",false);
52 execute_sql("ALTER TABLE {$CFG->prefix}exercise_elements DROP INDEX exerciseid;",false);
53 execute_sql("ALTER TABLE {$CFG->prefix}exercise_rubrics DROP INDEX exerciseid;",false);
54 execute_sql("ALTER TABLE {$CFG->prefix}exercise_grades DROP INDEX exerciseid;",false);
56 modify_database('','ALTER TABLE prefix_exercise ADD INDEX course (course);');
57 modify_database('','ALTER TABLE prefix_exercise_submissions ADD INDEX exerciseid (exerciseid);');
58 modify_database('','ALTER TABLE prefix_exercise_assessments ADD INDEX exerciseid (exerciseid);');
59 modify_database('','ALTER TABLE prefix_exercise_elements ADD INDEX exerciseid (exerciseid);');
60 modify_database('','ALTER TABLE prefix_exercise_rubrics ADD INDEX exerciseid (exerciseid);');
61 modify_database('','ALTER TABLE prefix_exercise_grades ADD INDEX exerciseid (exerciseid);');
64 ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.
66 return true;