MDL-22145 backup - allowing longer backup types in DB
This commit is contained in:
+1
-1
@@ -2461,7 +2461,7 @@
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="backupid"/>
|
||||
<FIELD NAME="backupid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="unique id of the backup" PREVIOUS="id" NEXT="type"/>
|
||||
<FIELD NAME="type" TYPE="char" LENGTH="6" NOTNULL="true" SEQUENCE="false" COMMENT="Type of the backup (activity/section/course)" PREVIOUS="backupid" NEXT="itemid"/>
|
||||
<FIELD NAME="type" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Type of the backup (activity/section/course)" PREVIOUS="backupid" NEXT="itemid"/>
|
||||
<FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="id of the module/section/activity being backup" PREVIOUS="type" NEXT="format"/>
|
||||
<FIELD NAME="format" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="format of the backup (moodle/imscc...)" PREVIOUS="itemid" NEXT="interactive"/>
|
||||
<FIELD NAME="interactive" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="is the backup interactive (1-yes/0-no)" PREVIOUS="format" NEXT="purpose"/>
|
||||
|
||||
@@ -3665,6 +3665,37 @@ AND EXISTS (SELECT 'x'
|
||||
upgrade_main_savepoint($result, 2010042801);
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2010042802) { // Change backup_controllers->type to varchar10 (recreate dep. index)
|
||||
|
||||
/// Define index typeitem_ix (not unique) to be dropped form backup_controllers
|
||||
$table = new xmldb_table('backup_controllers');
|
||||
$index = new xmldb_index('typeitem_ix', XMLDB_INDEX_NOTUNIQUE, array('type', 'itemid'));
|
||||
|
||||
/// Conditionally launch drop index typeitem_ix
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
/// Changing precision of field type on table backup_controllers to (10)
|
||||
$table = new xmldb_table('backup_controllers');
|
||||
$field = new xmldb_field('type', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, null, 'backupid');
|
||||
|
||||
/// Launch change of precision for field type
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
/// Define index typeitem_ix (not unique) to be added to backup_controllers
|
||||
$table = new xmldb_table('backup_controllers');
|
||||
$index = new xmldb_index('typeitem_ix', XMLDB_INDEX_NOTUNIQUE, array('type', 'itemid'));
|
||||
|
||||
/// Conditionally launch add index typeitem_ix
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
/// Main savepoint reached
|
||||
upgrade_main_savepoint($result, 2010042802);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2010042801; // YYYYMMDD = date of the last version bump
|
||||
$version = 2010042802; // YYYYMMDD = date of the last version bump
|
||||
// XX = daily increments
|
||||
|
||||
$release = '2.0 dev (Build: 20100428)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user