From c9e25b765d290036e30c459d61a6aa2f24be7d1e Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Tue, 18 Jul 2023 22:15:02 +0200 Subject: [PATCH] Added period table --- db/install.xml | 16 +++++++++++++++- db/upgrade.php | 25 +++++++++++++++++++++++++ version.php | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/db/install.xml b/db/install.xml index 622bd0b..1a3cba4 100644 --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -147,5 +147,19 @@ + + + + + + + + + + + + + +
diff --git a/db/upgrade.php b/db/upgrade.php index 3c8cd16..9012309 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -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; } \ No newline at end of file diff --git a/version.php b/version.php index 4652d55..5cebe15 100644 --- a/version.php +++ b/version.php @@ -1,6 +1,6 @@ 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 = [