MDL-33416 files: Remove unused reference fields in files table

Fields files.referencelastsync and files.referencelifetime just waste the space and actually duplicate the fields
files_reference.lifetime and files_reference.lastsync
This commit is contained in:
Marina Glancy
2013-09-27 16:50:08 +10:00
parent d45e65ccad
commit e2a61ee3db
6 changed files with 29 additions and 16 deletions
+1 -3
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20130921" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20130927" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -2437,8 +2437,6 @@
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="order of files"/>
<FIELD NAME="referencefileid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Use to indicate file is a proxy for repository file"/>
<FIELD NAME="referencelastsync" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Last time the proxy file was synced with repository, defined for performance reasons"/>
<FIELD NAME="referencelifetime" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="How often do we have to sync proxy file with repository, defined for performance reasons"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+24
View File
@@ -2555,5 +2555,29 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013092001.02);
}
if ($oldversion < 2013092700.01) {
$table = new xmldb_table('files');
// Define field referencelastsync to be dropped from files.
$field = new xmldb_field('referencelastsync');
// Conditionally launch drop field referencelastsync.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Define field referencelifetime to be dropped from files.
$field = new xmldb_field('referencelifetime');
// Conditionally launch drop field referencelifetime.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013092700.01);
}
return true;
}