moodle/mod/quiz/db/postgres7.php
moodler 54a67a5921 First cut at adding new "fixed" Match question type, which is manually
created.  Works OK after limited testing.

I've also renamed some strings to do with "Random Match", so that this
question type is now called "Random Short-Answer Match".

Later there will be a new 'Random Match' which randomly selects one of the
existing "Match" questions.
2003-03-30 16:46:50 +00:00

54 lines
2.4 KiB
PHP

<?PHP // $Id$
function quiz_upgrade($oldversion) {
// This function does anything necessary to upgrade
// older versions to match current functionality
global $CFG;
if ($oldversion < 2003010100) {
execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review integer DEFAULT '0' NOT NULL AFTER `grademethod` ");
}
if ($oldversion < 2003010301) {
table_column("quiz_truefalse", "true", "trueanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
table_column("quiz_truefalse", "false", "falseanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
table_column("quiz_questions", "type", "qtype", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
}
if ($oldversion < 2003022303) {
modify_database ("", "CREATE TABLE prefix_quiz_randommatch (
id SERIAL PRIMARY KEY,
question integer NOT NULL default '0',
choose integer NOT NULL default '4',
);");
}
if ($oldversion < 2003030303) {
table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image");
}
if ($oldversion < 2003033100) {
modify_database ("", "ALTER TABLE prefix_quiz_randommatch RENAME prefix_quiz_randomsamatch ");
modify_database ("", "CREATE TABLE `prefix_quiz_match_sub` (
id SERIAL PRIMARY KEY,
question integer NOT NULL default '0',
questiontext text NOT NULL default '',
answertext varchar(255) NOT NULL default ''
);");
modify_database ("", "CREATE INDEX question_prefix_quiz_match_sub_idx ON prefix_quiz_match_sub (question);");
modify_database ("", "CREATE TABLE prefix_quiz_multichoice (
id SERIAL PRIMARY KEY,
question integer NOT NULL default '0',
layout integer NOT NULL default '0',
answers varchar(255) NOT NULL default '',
single integer NOT NULL default '0'
);");
modify_database ("", "CREATE INDEX question_quiz_multichoice_idx ON prefix_quiz_multichoice (question);");
}
return true;
}
?>