From 8bc29d46b482d373d8e4f2c1629abd1775d2f122 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Sun, 18 Jul 2010 11:03:07 +0000 Subject: [PATCH] MDL-21840 backup - table for files handling on restore. Big thanks to MySQL for being so... limited? --- lib/db/install.xml | 25 +++++++++++++++++++++---- lib/db/upgrade.php | 29 +++++++++++++++++++++++++++++ version.php | 2 +- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index e404a68d52f..9ac6d47358a 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -2639,7 +2639,7 @@ - +
@@ -2657,7 +2657,24 @@
- +
+ + + + + + + + + + + + + + + +
+ @@ -2689,4 +2706,4 @@
-
+ \ No newline at end of file diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 8cf0881671f..f37e5beb55e 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -4834,6 +4834,35 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2010071701); } + if ($oldversion < 2010071800) { + + // Define table backup_files_template to be created + $table = new xmldb_table('backup_files_template'); + + // Adding fields to table backup_files_template + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('backupid', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null); + $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); + $table->add_field('filearea', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, null); + $table->add_field('itemid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('info', XMLDB_TYPE_TEXT, 'medium', null, null, null, null); + + // Adding keys to table backup_files_template + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + + // Adding indexes to table backup_files_template + $table->add_index('backupid_contextid_component_filearea_itemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid', 'contextid', 'component', 'filearea', 'itemid')); + + // Conditionally launch create table for backup_files_template + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2010071800); + } + return true; } diff --git a/version.php b/version.php index c31d858d542..4d7c0922924 100644 --- a/version.php +++ b/version.php @@ -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 = 2010071701; // YYYYMMDD = date of the last version bump + $version = 2010071800; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 Preview 4+ (Build: 20100718)'; // Human-friendly version name -- 2.43.0