enforcing unique constraint on (courseid, shortname) pair on outcomes
This commit is contained in:
+2
-1
@@ -1290,7 +1290,8 @@
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me" NEXT="courseid"/>
|
||||
<KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" PREVIOUS="primary" NEXT="scaleid"/>
|
||||
<KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id" PREVIOUS="courseid" NEXT="usermodified"/>
|
||||
<KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="scaleid"/>
|
||||
<KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="scaleid" NEXT="courseid-shortname"/>
|
||||
<KEY NAME="courseid-shortname" TYPE="unique" FIELDS="courseid, shortname" COMMENT="Default comment for the key, please edit me" PREVIOUS="usermodified"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
<TABLE NAME="grade_outcomes_courses" COMMENT="stores what outcomes are used in what courses." PREVIOUS="grade_outcomes" NEXT="grade_categories">
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user