From ce08355034069d45dd5b09bdc5c4ca81f7889b38 Mon Sep 17 00:00:00 2001 From: Myriam Delaruelle <Myriam Delaruelle@bdn-un-mdelarue.ad.univ-lorraine.fr> Date: Fri, 24 Sep 2021 10:34:51 +0200 Subject: [PATCH] support old version: drop old table when fields are old --- db/upgrade.php | 8 ++++++-- version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index 839aa76..4a50d0d 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -7,7 +7,7 @@ function xmldb_block_competency_iena_upgrade($oldversion) { $dbman = $DB->get_manager(); $result = TRUE; - if ($oldversion < 2021070600) { + if ($oldversion < 2021240901) { // Define field id to be added to block_competency_iena. $table = new xmldb_table('block_competency_iena'); @@ -23,6 +23,10 @@ function xmldb_block_competency_iena_upgrade($oldversion) { if (!$dbman->table_exists($table)) { $dbman->create_table($table); } + else if(!$dbman->field_exists('block_competency_iena', 'cmid')){ + $dbman->drop_table($table); + $dbman->create_table($table); + } //Support for old versions: we copy the already linked activities to the new database try { @@ -46,7 +50,7 @@ function xmldb_block_competency_iena_upgrade($oldversion) { } // Competency_iena savepoint reached. - upgrade_block_savepoint(true, 2021070600, 'competency_iena'); + upgrade_block_savepoint(true, 2021240901, 'competency_iena'); } return $result; diff --git a/version.php b/version.php index b312025..a04a797 100644 --- a/version.php +++ b/version.php @@ -28,7 +28,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021240900; +$plugin->version = 2021240901; $plugin->requires = 2014051200; $plugin->component = 'block_competency_iena'; $plugin->release = 'v1.0'; -- GitLab