Added period span field to item table

This commit is contained in:
PMKuipers 2023-08-03 22:23:56 +02:00
parent 76f82dd04c
commit f97c4cb2ef
3 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/treestudyplan/db" VERSION="20230720" COMMENT="XMLDB file for Moodle local/treestudyplan" <XMLDB PATH="local/treestudyplan/db" VERSION="20230803" COMMENT="XMLDB file for Moodle local/treestudyplan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
> >
@ -85,6 +85,7 @@
<FIELD NAME="badge_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="badge_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="course_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="course_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="continuation_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="continuation_id" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="span" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> <KEY NAME="primary" TYPE="primary" FIELDS="id"/>

View File

@ -418,6 +418,20 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023072000, 'local', 'treestudyplan'); upgrade_plugin_savepoint(true, 2023072000, 'local', 'treestudyplan');
} }
if ($oldversion < 2023080300) {
// Define field span to be added to local_treestudyplan_item.
$table = new xmldb_table('local_treestudyplan_item');
$field = new xmldb_field('span', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '1', 'continuation_id');
// Conditionally launch add field span.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023080300, 'local', 'treestudyplan');
}
return true; return true;

View File

@ -1,6 +1,6 @@
<?php <?php
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494) $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
$plugin->version = 2023072801; // YYYYMMDDHH (year, month, day, iteration) $plugin->version = 2023080300; // YYYYMMDDHH (year, month, day, iteration)
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11) $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
$plugin->dependencies = [ $plugin->dependencies = [