]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_14_STABLE: Attempt to fix the unique index on quiz_attemptonlast_d...
authormjollnir_ <mjollnir_>
Tue, 23 Nov 2004 05:04:53 +0000 (05:04 +0000)
committermjollnir_ <mjollnir_>
Tue, 23 Nov 2004 05:04:53 +0000 (05:04 +0000)
mod/quiz/db/postgres7.php
mod/quiz/version.php

index 27f3db0014e07059c5caf935311774075d970174..ea1d496945434a25e34d5474ab47640c76fa14d6 100644 (file)
@@ -267,6 +267,13 @@ function quiz_upgrade($oldversion) {
         modify_database('','CREATE INDEX prefix_quiz_responses_question_idx ON prefix_quiz_responses (question);');
     }
 
+    if ($oldversion < 2004112300) { //try and clean up an old mistake - try and bring us up to what is in postgres7.sql today.
+        execute_sql("ALTER TABLE {$CFG->prefix}quiz_attemptonlast_datasets DROP CONSTRAINT category;",false);
+        execute_sql("ALTER TABLE {$CFG->prefix}quiz_attemptonlast_datasets DROP CONSTRAINT {$CFG->prefix}quiz_attemptonlast_datasets_category_userid;",false);
+        execute_sql("ALTER TABLE {$CFG->prefix}quiz_attemptonlast_datasets DROP CONSTRAINT {$CFG->prefix}quiz_category_userid_unique;",false);
+        modify_database('','ALTER TABLE prefix_quiz_attemptonlast_datasets ADD CONSTRAINT prefix_quiz_category_userid_unique UNIQUE (category,userid);');
+    }
+
     return true;
 }
 
index 22050fd7cea504c41481a0a23a1b0d8d87924f47..ea700c8373ae01e88c580681ce44f1edf32cf0be 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004111700;   // The (date) version of this module
-$module->requires = 2004091700;   // Requires this Moodle version
+$module->version  = 2004112300;   // The (date) version of this module
+$module->requires = 2004112300;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
 ?>