Browse Source

Change name of game_cross.rows to usedrows (MariaDB compatibility)

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
6bc7177e69
  1. 2
      db/install.xml
  2. 30
      db/upgrade.php
  3. 2
      version.php

2
db/install.xml

@ -139,7 +139,7 @@
<TABLE NAME="game_cross" COMMENT="game_cross"> <TABLE NAME="game_cross" COMMENT="game_cross">
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usedcols" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="usedrows" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usedrows" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="usedrows" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="words" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="words" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="wordsall" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="wordsall" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>

30
db/upgrade.php

@ -1556,5 +1556,35 @@ function xmldb_game_upgrade($oldversion) {
$dbman->change_field_type($table, $field); $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; return true;
} }

2
version.php

@ -35,7 +35,7 @@ if (!isset( $plugin)) {
} }
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). $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->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-06-13'; $plugin->release = '2017-06-13';

Loading…
Cancel
Save