From 3669ecf701aa8c00399e7668fb6cee42bd748150 Mon Sep 17 00:00:00 2001 From: tuanngocnguyen Date: Fri, 21 Jun 2019 08:42:29 +1000 Subject: [PATCH] DBSchema issue (#398) * make sure sessiondetailspos to match install.xml * make sure maxwarn has default value of 1 --- db/install.xml | 2 +- db/upgrade.php | 21 +++++++++++++++++++++ version.php | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/db/install.xml b/db/install.xml index 72f2e19..01f7a09 100644 --- a/db/install.xml +++ b/db/install.xml @@ -127,7 +127,7 @@ - + diff --git a/db/upgrade.php b/db/upgrade.php index 9bdfba7..eedccf3 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -565,5 +565,26 @@ function xmldb_attendance_upgrade($oldversion=0) { upgrade_mod_savepoint(true, 2019061800, 'attendance'); } + if ($oldversion < 2019062000) { + // Make sure sessiondetailspos is not null. + $table = new xmldb_table('attendance'); + $field = new xmldb_field('sessiondetailspos', XMLDB_TYPE_CHAR, '5', null, XMLDB_NOTNULL, null, 'left', 'subnet'); + + if ($dbman->field_exists($table, $field)) { + $dbman->change_field_notnull($table, $field); + } + + // Make sure maxwarn has default value of '1'. + $table = new xmldb_table('attendance_warning'); + $field = new xmldb_field('maxwarn', XMLDB_TYPE_INTEGER, '10', null, true, null, '1', 'warnafter'); + + if ($dbman->field_exists($table, $field)) { + $dbman->change_field_default($table, $field); + } + + // Attendance savepoint reached. + upgrade_mod_savepoint(true, 2019062000, 'attendance'); + } + return $result; } diff --git a/version.php b/version.php index 55f125e..ca652c0 100644 --- a/version.php +++ b/version.php @@ -23,7 +23,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2019061800; +$plugin->version = 2019062000; $plugin->requires = 2018102700; // Requires 3.6. $plugin->release = '3.6.7'; $plugin->maturity = MATURITY_STABLE;