From: toyomoyo Date: Thu, 8 Nov 2007 02:01:34 +0000 (+0000) Subject: merged fix for MDL-11909, putting a unique constraint userid-itemid on grade_grades... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1dda50ea089b92323aab73dda665f3db4bd7c77e;p=moodle.git merged fix for MDL-11909, putting a unique constraint userid-itemid on grade_grades table --- diff --git a/lib/db/install.xml b/lib/db/install.xml index ddb0d817db..f2553a63a7 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -1301,7 +1301,8 @@ - + + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 13429501a0..94858d0bd5 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2583,6 +2583,20 @@ function xmldb_main_upgrade($oldversion=0) { // Could not create the readme file. No cause for huge concern notify("Could not create the README.txt file in $readmefilename."); } + } + + if ($result && $oldversion < 2007101502) { + + /// Define key userid-itemid (unique) to be added to grade_grades + $table = new XMLDBTable('grade_grades'); + $key = new XMLDBKey('userid-itemid'); + $key->setAttributes(XMLDB_KEY_UNIQUE, array('userid', 'itemid')); + + /// Launch add key userid-itemid + $result = $result && add_key($table, $key); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2007101502); } return $result; diff --git a/version.php b/version.php index 049b4d0185..26d2c53643 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007101501; // YYYYMMDD = date + $version = 2007101502; // YYYYMMDD = date // XY = increments within a single day $release = '2.0 dev'; // Human-friendly version name