From 6ae92cf9b0870ea3674b54e698f90ecf0132e5c6 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 1 Mar 2006 02:17:47 +0000 Subject: [PATCH] Fixing up a badly named quiz table in postgres. PLEASE remember that you cannot just do RENAME - it breaks the sequences --- mod/quiz/db/postgres7.php | 7 +++++++ mod/quiz/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 707fff10fea..e08b02dc452 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -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; } diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 65e4f44f8d1..8fa847db287 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -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)?