Commit ca51ed79 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1813987: Creating tables for gridstack page blocks

and remove 'unique constraint' on block_instance table on
view,row,column and order columns

behatnotneeded

Change-Id: Icee562986422d82506f43748ec968abd9d1d7146
parent 61acdaa6
......@@ -859,7 +859,6 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="blocktypefk" TYPE="foreign" FIELDS="blocktype" REFTABLE="blocktype_installed" REFFIELDS="name" />
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
<KEY NAME="viewrowcolumnorderuk" TYPE="unique" FIELDS="view,row,column,order" />
</KEYS>
</TABLE>
<TABLE NAME="view_artefact">
......@@ -1449,5 +1448,18 @@
<KEY NAME="primary" TYPE="primary" FIELDS="role" />
</KEYS>
</TABLE>
<TABLE NAME="block_instance_dimension">
<FIELDS>
<FIELD NAME="block" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="positionx" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="positiony" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="width" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="4" />
<FIELD NAME="height" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="4" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="block" />
<KEY NAME="blockfk" TYPE="foreign" FIELDS="block" REFTABLE="block_instance" REFFIELDS="id" />
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
......@@ -1389,5 +1389,25 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2019080600) {
log_debug('create block dimension table for gridstack layout');
$table = new XMLDBTable('block_instance_dimension');
$table->addFieldInfo('block', XMLDB_TYPE_INTEGER, 10, false, XMLDB_NOTNULL);
$table->addFieldInfo('positionx', XMLDB_TYPE_INTEGER, 2, false, XMLDB_NOTNULL, null, null, null, 0);
$table->addFieldInfo('positiony', XMLDB_TYPE_INTEGER, 10, false, XMLDB_NOTNULL, null, null, null, 0);
$table->addFieldInfo('width', XMLDB_TYPE_INTEGER, 2, false, XMLDB_NOTNULL, null, null, null, 4);
$table->addFieldInfo('height', XMLDB_TYPE_INTEGER, 2, false, XMLDB_NOTNULL, null, null, null, 4);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('block'));
$table->addKeyInfo('blockfk', XMLDB_KEY_FOREIGN, array('block'), 'block_instance', array('id'));
create_table($table);
log_debug('drop constraint from block_instance table in row, column and order');
$table = new XMLDBTable('block_instance');
$key = new XMLDBKey('viewrowcolumnorderuk');
$key->setAttributes(XMLDB_KEY_UNIQUE, array('view', 'row', 'column', 'order'));
drop_key($table, $key);
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2019080200;
$config->version = 2019080600;
$config->series = '19.10';
$config->release = '19.10dev';
$config->minupgradefrom = 2017031605;
......
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