MDL-33430 Add newcontextid and newitemid to backup_files_template

These new fields will be used to hold the new location of the file once
it is sent to the filepool during the restore.
This commit is contained in:
David Mudrák 2012-06-20 11:15:47 +02:00
parent 4b6b087faf
commit 38ca2f1a83
3 changed files with 30 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20120531" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20120620" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@ -2753,7 +2753,9 @@
<FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="contextid" NEXT="filearea"/>
<FIELD NAME="filearea" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" PREVIOUS="component" NEXT="itemid"/>
<FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="filearea" NEXT="info"/>
<FIELD NAME="info" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="to store the complete file record (serialized)" PREVIOUS="itemid"/>
<FIELD NAME="info" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="to store the complete file record (serialized)" PREVIOUS="itemid" NEXT="newcontextid"/>
<FIELD NAME="newcontextid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The new contextid that the file has been restored to." PREVIOUS="info" NEXT="newitemid"/>
<FIELD NAME="newitemid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The new itemid the file has been restored to." PREVIOUS="newcontextid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
@ -2874,4 +2876,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>

View File

@ -830,5 +830,29 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012060600.04);
}
if ($oldversion < 2012061800.01) {
// Add field newcontextid to backup_files_template
$table = new xmldb_table('backup_files_template');
$field = new xmldb_field('newcontextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'info');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_main_savepoint(true, 2012061800.01);
}
if ($oldversion < 2012061800.02) {
// Add field newitemid to backup_files_template
$table = new xmldb_table('backup_files_template');
$field = new xmldb_field('newitemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'newcontextid');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_main_savepoint(true, 2012061800.02);
}
return true;
}

View File

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