diff --git a/db/install.xml b/db/install.xml index 64dd341..3624a63 100755 --- a/db/install.xml +++ b/db/install.xml @@ -139,7 +139,7 @@ - + diff --git a/db/upgrade.php b/db/upgrade.php index 4e3f56d..bea7a9d 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -1556,5 +1556,35 @@ function xmldb_game_upgrade($oldversion) { $dbman->change_field_type($table, $field); } + if ($oldversion < ($ver = 2017061603)) { + $table = new xmldb_table('game_cross'); + $field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); + $dbman->add_field($table, $field); + + $field = new xmldb_field('cols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); + if ($dbman->field_exists($table, $field)) { + $sql = "UPDATE {$CFG->prefix}game_cross SET usedcols=cols"; + $DB->execute( $sql); + $dbman->drop_field($table, $field); + } else { + $dbman->add_field($table, $field); + } + } + + if ($oldversion < ($ver = 2017061603)) { + $table = new xmldb_table('game_cross'); + $field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); + $dbman->add_field($table, $field); + + $field = new xmldb_field('rows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); + if ($dbman->field_exists($table, $field)) { + $sql = "UPDATE {$CFG->prefix}game_cross SET usedrows=rows"; + $DB->execute( $sql); + $dbman->drop_field($table, $field); + } else { + $dbman->add_field($table, $field); + } + } + return true; } diff --git a/version.php b/version.php index 97a64cb..57ba01a 100644 --- a/version.php +++ b/version.php @@ -35,7 +35,7 @@ if (!isset( $plugin)) { } $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). -$plugin->version = 2017061301; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2017061603; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->cron = 0; // Period for cron to check this module (secs). $plugin->release = '2017-06-13';