diff --git a/lib/db/install.xml b/lib/db/install.xml index b2b765f2242..e95b9c7dd70 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -930,7 +930,7 @@ - +
@@ -946,7 +946,25 @@
- +
+ + + + + + + + + + + + + + + + +
+ diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index f02f7f3fbea..17b65c093dc 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -632,6 +632,32 @@ function xmldb_main_upgrade($oldversion=0) { unset_config('tabselectedtofront'); } + + if ($result && $oldversion < 2007032200) { + + /// Define table role_sortorder to be created + $table = new XMLDBTable('role_sortorder'); + + /// Adding fields to table role_sortorder + $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('roleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('sortoder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null); + + /// Adding keys to table role_sortorder + $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); + $table->addKeyInfo('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id')); + $table->addKeyInfo('roleid', XMLDB_KEY_FOREIGN, array('roleid'), 'role', array('id')); + $table->addKeyInfo('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id')); + + /// Adding indexes to table role_sortorder + $table->addIndexInfo('userid-roleid-contextid', XMLDB_INDEX_UNIQUE, array('userid', 'roleid', 'contextid')); + + /// Launch create table for role_sortorder + $result = $result && create_table($table); + } + return $result; } diff --git a/version.php b/version.php index a0e5739703d..b115fd617e3 100644 --- a/version.php +++ b/version.php @@ -6,9 +6,9 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007021501; // YYYYMMDD = date + $version = 2007032200; // YYYYMMDD = date // XY = increments within a single day $release = '1.9 dev'; // Human-friendly version name -?> +?> \ No newline at end of file