From b318ecfd47abc498c65d85b88dd969336a134194 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Thu, 22 Mar 2007 07:14:43 +0000 Subject: [PATCH] MDL-8965, adding db table to support sorting or course manager roles in course --- lib/db/install.xml | 24 +++++++++++++++++++++--- lib/db/upgrade.php | 26 ++++++++++++++++++++++++++ version.php | 4 ++-- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index b2b765f224..e95b9c7dd7 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 f02f7f3fbe..17b65c093d 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 a0e5739703..b115fd617e 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 -- 2.39.5