Fixing up a badly named quiz table in postgres. PLEASE remember that you cannot just do RENAME - it breaks the sequences

This commit is contained in:
mjollnir_
2006-03-01 02:17:47 +00:00
parent cfe3f66f47
commit 6ae92cf9b0
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -1037,6 +1037,13 @@ function quiz_upgrade($oldversion) {
table_column('question_sessions', 'sumpenalty', 'sumpenalty', 'real', '', '', '0', 'not null');
}
if ($oldversion < 2006030100) {
// Fix up another table rename :(
// THIS caused the mistake: execute_sql("ALTER TABLE {$CFG->prefix}quiz_newest_states RENAME TO {$CFG->prefix}question_sessions", false);
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_newest_states_id_seq RENAME TO '.$CFG->prefix.'question_sessions_id_seq',false);
execute_sql('ALTER TABLE '.$CFG->prefix.'question_sessions ALTER COLUMN id SET DEFAULT nextval(\''.$CFG->prefix.'question_sessions_id_seq\')',false);
}
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2006022402; // The (date) version of this module
$module->version = 2006030100; // The (date) version of this module
$module->requires = 2006022400; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?