Commit b3778ee5 authored by Richard Mansfield's avatar Richard Mansfield

Force one collection per view in db; combine collection upgrades

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 262f59d8
......@@ -812,7 +812,7 @@
<FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="collection,view" />
<KEY NAME="primary" TYPE="primary" FIELDS="view" />
<KEY NAME="collectionfk" TYPE="foreign" FIELDS="collection" REFTABLE="collection" REFFIELDS="id" />
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
</KEYS>
......
......@@ -2092,7 +2092,7 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2010080400) {
if ($oldversion < 2010081000) {
// new table collection
$table = new XMLDBTable('collection');
......@@ -2102,6 +2102,7 @@ function xmldb_core_upgrade($oldversion=0) {
$table->addFieldInfo('ctime', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('mtime', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('description', XMLDB_TYPE_TEXT, null);
$table->addFieldInfo('navigation', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 1);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('usrfk', XMLDB_KEY_FOREIGN, array('owner'), 'usr', array('id'));
create_table($table);
......@@ -2110,24 +2111,12 @@ function xmldb_core_upgrade($oldversion=0) {
$table = new XMLDBTable('collection_view');
$table->addFieldInfo('view', XMLDB_TYPE_INTEGER, 10, false, XMLDB_NOTNULL);
$table->addFieldInfo('collection', XMLDB_TYPE_INTEGER, 10, false, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('view','collection'));
$table->addFieldInfo('displayorder', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('view'));
$table->addKeyInfo('viewfk', XMLDB_KEY_FOREIGN, array('view'), 'view', array('id'));
$table->addKeyInfo('collectionfk', XMLDB_KEY_FOREIGN, array('collection'), 'collection', array('id'));
create_table($table);
}
if ($oldversion < 2010080401) {
// new field displayorder on collection_view
$table = new XMLDBTable('collection_view');
$field = new XMLDBField('displayorder');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, XMLDB_NOTNULL);
add_field($table, $field);
}
if ($oldversion < 2010080402) {
// Drop unique constraint on token column of view_access
$table = new XMLDBTable('view_access');
$index = new XMLDBIndex('tokenuk');
......@@ -2139,12 +2128,5 @@ function xmldb_core_upgrade($oldversion=0) {
}
if ($oldversion < 2010080500) {
$table = new XMLDBTable('collection');
$field = new XMLDBField('navigation');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 1);
add_field($table, $field);
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010080500;
$config->version = 2010081000;
$config->release = '1.3.0beta4dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
Markdown is supported
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