Bugfix for erroneous field in table

This commit is contained in:
PMKuipers 2023-08-21 22:02:58 +02:00
parent 723e8a24b3
commit 4515cc1b92
3 changed files with 22 additions and 3 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="20230809" COMMENT="XMLDB file for Moodle local/treestudyplan" <XMLDB PATH="local/treestudyplan/db" VERSION="20230821" 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"
> >
@ -62,7 +62,6 @@
<TABLE NAME="local_treestudyplan_line" COMMENT="Table"> <TABLE NAME="local_treestudyplan_line" COMMENT="Table">
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="true"/> <FIELD NAME="id" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="studyplan_id" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="page_id" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="page_id" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="text" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="name" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="shortname" TYPE="text" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="shortname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>

View file

@ -455,5 +455,25 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
// Treestudyplan savepoint reached. // Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023080900, 'local', 'treestudyplan'); upgrade_plugin_savepoint(true, 2023080900, 'local', 'treestudyplan');
} }
if ($oldversion < 2023082100) {
// Up to version 20230821 the studyplan_id field still existed in the install.xml file
// Below code remedies that - even though this is a repeat of part of an earlier upgrade
// Define field studyplan_id to be dropped from local_treestudyplan_line.
$table = new xmldb_table('local_treestudyplan_line');
$field = new xmldb_field('studyplan_id');
// Conditionally launch drop field studyplan_id.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023082100, '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 = 2023081800; // YYYYMMDDHH (year, month, day, iteration) $plugin->version = 2023082100; // 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 = [