#123 Renamed column to avoid breaking Oracle

The word 'size' is a reserved word in Oracle.
This commit is contained in:
Mark Nelson 2017-08-05 15:45:35 +08:00
parent 5299a83209
commit 87ee9f10ce
5 changed files with 24 additions and 10 deletions

View file

@ -78,7 +78,7 @@
<FIELD NAME="element" TYPE="text" LENGTH="big" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="data" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="font" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="size" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="fontsize" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="colour" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="posx" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="posy" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>

View file

@ -121,5 +121,19 @@ function xmldb_customcert_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2017050502, 'customcert');
}
if ($oldversion < 2017050506) {
$table = new xmldb_table('customcert_elements');
$field = new xmldb_field('size');
// Rename column as it is a reserved word in Oracle.
if ($dbman->field_exists($table, $field)) {
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'font');
$dbman->rename_field($table, $field, 'fontsize');
}
// Savepoint reached.
upgrade_mod_savepoint(true, 2017050506, 'customcert');
}
return true;
}