diff --git a/lib/db/install.xml b/lib/db/install.xml
index 1ed0ce1b596..aa743914b76 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -1290,7 +1290,8 @@
-
+
+
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index e47a55ea191..ad696fb93b7 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -1553,7 +1553,18 @@ function xmldb_main_upgrade($oldversion=0) {
}
}
+
+ // adding unique contraint on (courseid,shortname) of an outcome
+ if ($result && $oldversion < 2007080100) {
+ /// Define key courseid-shortname (unique) to be added to grade_outcomes
+ $table = new XMLDBTable('grade_outcomes');
+ $key = new XMLDBKey('courseid-shortname');
+ $key->setAttributes(XMLDB_KEY_UNIQUE, array('courseid', 'shortname'));
+
+ /// Launch add key courseid-shortname
+ $result = $result && add_key($table, $key);
+ }
/*
/// drop old gradebook tables
diff --git a/version.php b/version.php
index cfd1c685fc9..4639b699d6c 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 = 2007073105; // YYYYMMDD = date
+ $version = 2007080100; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name