Skip to content

Commit

Permalink
Fixing up a badly named quiz table in postgres. PLEASE remember that …
Browse files Browse the repository at this point in the history
…you cannot just do RENAME - it breaks the sequences
  • Loading branch information
mjollnir_ committed Mar 1, 2006
1 parent cfe3f66 commit 6ae92cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mod/quiz/db/postgres7.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
Expand Down

0 comments on commit 6ae92cf

Please sign in to comment.