table_column('question', 'version', 'version', 'varchar', 255);
}
+ if ($oldversion < 2006042800) {
+ // Check we have some un-renamed tables (verified in some servers)
+ if ($tables = $db->MetaTables('TABLES')) {
+ if (in_array($CFG->prefix.'quiz_randommatch', $tables) &&
+ !in_array($CFG->prefix.'question_randomsamatch', $tables)) {
+ modify_database ("", "ALTER TABLE prefix_quiz_randommatch RENAME prefix_question_randomsamatch ");
+ }
+ // Check for one possible missing field in one table
+ if ($columns = $db->MetaColumnNames($CFG->prefix.'question_randomsamatch')) {
+ if (!in_array('shuffleanswers', $columns)) {
+ table_column('question_randomsamatch', '', 'shuffleanswers', 'tinyint', '4', 'unsigned', '1', 'not null', 'choose');
+ }
+ }
+ }
+ }
+
return true;
}
table_column('question', 'version', 'version', 'varchar', 255);
}
+ if ($oldversion < 2006042800) {
+ // Check we have some un-renamed tables (verified in some servers)
+ if ($tables = $db->MetaTables('TABLES')) {
+ if (in_array($CFG->prefix.'quiz_randommatch', $tables) &&
+ !in_array($CFG->prefix.'question_randomsamatch', $tables)) {
+ modify_database ("", "ALTER TABLE prefix_quiz_randommatch RENAME prefix_question_randomsamatch ");
+ modify_database ("", "ALTER TABLE prefix_quiz_randommatch_id_seq RENAME prefix_question_randomsamatch_id_seq ");
+ execute_sql('ALTER TABLE '.$CFG->prefix.'question_randomsamatch ALTER COLUMN id SET DEFAULT nextval(\''.$CFG->prefix.'question_randomsamatch_id_seq\')',false);
+ }
+ // Check for one possible missing field in one table
+ if ($columns = $db->MetaColumnNames($CFG->prefix.'question_randomsamatch')) {
+ if (!in_array('shuffleanswers', $columns)) {
+ table_column('question_randomsamatch', '', 'shuffleanswers', 'tinyint', '4', 'unsigned', '1', 'not null', 'choose');
+ }
+ }
+ }
+ }
+
return true;
}
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006041001; // The (date) version of this module
+$module->version = 2006042800; // The (date) version of this module
$module->requires = 2006022400; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?