From: paca70 Date: Fri, 3 Sep 2004 10:49:44 +0000 (+0000) Subject: New field "guid" added to table user. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=01e2ea5fa33acdc6ba0f2ef7adfe5fbbae8282ff;p=moodle.git New field "guid" added to table user. This can be userd to store "global unique identifier" from external databases like Windows SID or eDirectorys guid . This will keep upcoming user syncronization feature reliable in case of renamed users. Mysql files are untested. php -l mysql.php does not show any syntax errors, so files should work. --- diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 4147c5e166..f7d4cae729 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -849,6 +849,11 @@ function main_upgrade($oldversion=0) { if ($oldversion < 2004082900) { // Make sure guest is "manual" too. set_field('user', 'auth', 'manual', 'username', 'guest'); } + + if ($oldversion < 2004090300) { // Add guid-field used in user syncronization + table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth'); + execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)"); + } return $result; diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index e04ace5a40..5fe5a8e461 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -308,6 +308,7 @@ CREATE TABLE `prefix_scale` ( CREATE TABLE `prefix_user` ( `id` int(10) unsigned NOT NULL auto_increment, `auth` varchar(20) NOT NULL default 'manual', + `guid` varchar(128) default NULL, `confirmed` tinyint(1) NOT NULL default '0', `deleted` tinyint(1) NOT NULL default '0', `username` varchar(100) NOT NULL default '', @@ -346,6 +347,8 @@ CREATE TABLE `prefix_user` ( UNIQUE KEY `id` (`id`), UNIQUE KEY `username` (`username`) ) TYPE=MyISAM COMMENT='One record for each person'; + +ALTER TABLE `prefix_user` ADD INDEX `authguid` (`auth`, `guid`); # -------------------------------------------------------- # diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index ed2b431da5..11d46a1f7d 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -584,6 +584,11 @@ function main_upgrade($oldversion=0) { set_field('user', 'auth', 'manual', 'username', 'guest'); } + if ($oldversion < 2004090300) { // Add guid-field used in user syncronization + table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth'); + execute_sql("CREATE INDEX {$CFG->prefix}user_auth_guid_idx ON {$CFG->prefix}user (auth, guid)"); + } + return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 8ab5470b2c..037d3d2639 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -198,6 +198,7 @@ CREATE INDEX prefix_cache_text_md5key_idx ON prefix_cache_text (md5key); CREATE TABLE prefix_user ( id SERIAL PRIMARY KEY, auth varchar(20) NOT NULL default 'manual', + guid varchar(128) default NULL, confirmed integer NOT NULL default '0', deleted integer NOT NULL default '0', username varchar(100) NOT NULL default '', @@ -235,6 +236,8 @@ CREATE TABLE prefix_user ( CONSTRAINT prefix_user_username_uk UNIQUE (username) ); +CREATE INDEX prefix_user_auth_guid_idx ON prefix_user (auth, guid); + CREATE TABLE prefix_user_admins ( id SERIAL PRIMARY KEY, userid integer NOT NULL default '0' diff --git a/version.php b/version.php index efaf553c2a..51f1681676 100644 --- a/version.php +++ b/version.php @@ -5,7 +5,7 @@ // database to determine whether upgrades should // be performed (see lib/db/*.php) -$version = 2004083000; // The current version is a date (YYYYMMDDXX) +$version = 2004090300; // The current version is a date (YYYYMMDDXX) $release = "1.5 unstable development"; // User-friendly version number