#71 Increase customcert_templates 'name' column length

This commit is contained in:
Mark Nelson 2017-01-31 16:54:20 +08:00
parent dabc959826
commit ee3bdf7c18
3 changed files with 16 additions and 2 deletions

View file

@ -25,7 +25,7 @@
<TABLE NAME="customcert_templates" COMMENT="Stores each customcert template"> <TABLE NAME="customcert_templates" COMMENT="Stores each customcert template">
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References contextid."/> <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References contextid."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>

View file

@ -31,5 +31,19 @@ defined('MOODLE_INTERNAL') || die;
* @return bool always true * @return bool always true
*/ */
function xmldb_customcert_upgrade($oldversion) { function xmldb_customcert_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2016120503) {
$table = new xmldb_table('customcert_templates');
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'id');
$dbman->change_field_precision($table, $field);
// Savepoint reached.
upgrade_mod_savepoint(true, 2016120503, 'customcert');
}
return true; return true;
} }

View file

@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2016120502; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2016120503; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2016120500; // Requires this Moodle version (3.2). $plugin->requires = 2016120500; // Requires this Moodle version (3.2).
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->component = 'mod_customcert'; $plugin->component = 'mod_customcert';