diff --git a/lib/db/install.xml b/lib/db/install.xml index 817c6be4167..277e4011547 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -741,7 +741,9 @@ - + + + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 7821efb7cf0..8904ad4c533 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1024,6 +1024,38 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint($result, 2008111200); } +/// Add a unique index to the role.name column. + if ($result && $oldversion < 2008111800) { + + /// Define index name (unique) to be added to role + $table = new xmldb_table('role'); + $index = new xmldb_index('name', XMLDB_INDEX_UNIQUE, array('name')); + + /// Conditionally launch add index name + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + /// Main savepoint reached + upgrade_main_savepoint($result, 2008111800); + } + +/// Add a unique index to the role.shortname column. + if ($result && $oldversion < 2008111801) { + + /// Define index shortname (unique) to be added to role + $table = new xmldb_table('role'); + $index = new xmldb_index('shortname', XMLDB_INDEX_UNIQUE, array('shortname')); + + /// Conditionally launch add index shortname + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + /// Main savepoint reached + upgrade_main_savepoint($result, 2008111801); + } + return $result; } diff --git a/version.php b/version.php index 300a43b55e1..27e4600a844 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 = 2008111200; // YYYYMMDD = date of the last version bump + $version = 2008111801; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20081118)'; // Human-friendly version name