Added period table

This commit is contained in:
PMKuipers 2023-07-18 22:15:02 +02:00
parent a036cf1106
commit c9e25b765d
3 changed files with 41 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/treestudyplan/db" VERSION="20230630" COMMENT="XMLDB file for Moodle local/treestudyplan"
<XMLDB PATH="local/treestudyplan/db" VERSION="20230718" COMMENT="XMLDB file for Moodle local/treestudyplan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@ -147,5 +147,19 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="local_treestudyplan_period" COMMENT="Stores timing information about the different periods in a study plan page">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="studyplan_id" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="period" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="starttime" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="endtime" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="shortname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="fullname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>

View File

@ -219,6 +219,31 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
// Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023063002, 'local', 'treestudyplan');
}
if ($oldversion < 2023071801) {
// Define table local_treestudyplan_period to be created.
$table = new xmldb_table('local_treestudyplan_period');
// Adding fields to table local_treestudyplan_period.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('studyplan_id', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('period', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('starttime', XMLDB_TYPE_INTEGER, '20', null, null, null, null);
$table->add_field('endtime', XMLDB_TYPE_INTEGER, '20', null, null, null, null);
$table->add_field('shortname', XMLDB_TYPE_TEXT, null, null, null, null, null);
$table->add_field('fullname', XMLDB_TYPE_TEXT, null, null, null, null, null);
// Adding keys to table local_treestudyplan_period.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
// Conditionally launch create table for local_treestudyplan_period.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023071801, 'local', 'treestudyplan');
}
return true;
}

View File

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