Commit f3b11d3c authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add urlid fields to usr, group, and view tables



Bug #1006634, part 1

These columns will hold the portions of a full page url which relate
to users, groups, and views respectively.

Change-Id: I50e19f822ef2b8e2f0116db81f27cb4d3bb1bd53
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent e250631d
......@@ -142,6 +142,7 @@
<FIELD NAME="showhomeinfo" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
<FIELD NAME="logintries" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="unread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="urlid" TYPE="char" LENGTH="30" NOTNULL="false" />
<!-- If adding a datetime column, you should also update the relevant
functions in htdocs/auth/user.php and htdocs/lib/user.php to convert the
value to a timestamp when a record is retrieved -->
......@@ -152,6 +153,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="usernameuk" UNIQUE="true" FIELDS="username"/>
<INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid" />
</INDEXES>
</TABLE>
<TABLE NAME="usr_institution">
......@@ -354,6 +356,7 @@
<FIELD NAME="hidemembersfrommembers" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="invitefriends" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="suggestfriends" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="urlid" TYPE="char" LENGTH="30" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......@@ -364,6 +367,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="instshortuk" UNIQUE="true" FIELDS="institution, shortname"/>
<INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid" />
</INDEXES>
</TABLE>
<TABLE NAME="group_member">
......@@ -686,6 +690,7 @@
<FIELD NAME="approvecomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="accessconf" TYPE="char" LENGTH="40" NOTNULL="false"/>
<FIELD NAME="locked" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
<FIELD NAME="urlid" TYPE="char" LENGTH="100" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......@@ -697,6 +702,9 @@
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="view_type" REFFIELDS="type" />
</KEYS>
<INDEXES>
<INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid,owner,group,institution" />
</INDEXES>
</TABLE>
<TABLE NAME="view_tag">
<FIELDS>
......
......@@ -2893,5 +2893,35 @@ function xmldb_core_upgrade($oldversion=0) {
add_key($table, $key);
}
if ($oldversion < 2012053100) {
// Clean url fields for usr, group, and view tables.
$table = new XMLDBTable('usr');
$field = new XMLDBField('urlid');
$field->setAttributes(XMLDB_TYPE_CHAR, 30, null, null);
add_field($table, $field);
$index = new XMLDBIndex('urliduk');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('urlid'));
add_index($table, $index);
$table = new XMLDBTable('group');
$field = new XMLDBField('urlid');
$field->setAttributes(XMLDB_TYPE_CHAR, 30, null, null);
add_field($table, $field);
$index = new XMLDBIndex('urliduk');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('urlid'));
add_index($table, $index);
$table = new XMLDBTable('view');
$field = new XMLDBField('urlid');
$field->setAttributes(XMLDB_TYPE_CHAR, 100, null, null);
add_field($table, $field);
$index = new XMLDBIndex('urliduk');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('urlid', 'owner', 'group', 'institution'));
add_index($table, $index);
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2012051500;
$config->version = 2012053100;
$config->release = '1.6.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment