MDL-44316 upgrade: fix to ensure upgraded and new installations have matching 'tag_instance' tables

This commit is contained in:
Mark Nelson 2014-03-25 20:43:13 -07:00
parent e1190da615
commit 0a341617e4
2 changed files with 17 additions and 1 deletions

View File

@ -3324,5 +3324,21 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2014032600.00);
}
if ($oldversion < 2014032600.01) {
// Change the default value of the 'contextid' field to null.
$table = new xmldb_table('tag_instance');
$field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, false, null, null, 'itemid');
// Launch change of default for field 'contextid'.
$dbman->change_field_default($table, $field);
// Define the 'contextid' foreign key to be added to the tag_instance table.
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
$dbman->add_key($table, $key);
// Main savepoint reached.
upgrade_main_savepoint(true, 2014032600.01);
}
return true;
}

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2014032600.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2014032600.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.