From d1c1105248c156969f6b1271134c7bfcef8676ea Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Sat, 17 Jul 2010 11:23:52 +0000 Subject: [PATCH] MDL-21432 backup - make itemname bigger so it can store file component/area named --- lib/db/install.xml | 4 ++-- lib/db/upgrade.php | 31 +++++++++++++++++++++++++++++++ version.php | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index da798691b2f..87bb9fa3946 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -2687,7 +2687,7 @@ - + @@ -2733,4 +2733,4 @@ - \ No newline at end of file + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 5f532e08e0d..bafb19dea89 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -4790,6 +4790,37 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2010071300); } + if ($oldversion < 2010071700) { // Make itemname bigger (160cc) to store component+filearea + + $table = new xmldb_table('backup_ids_template'); + // Define key backupid_itemname_itemid_uk (unique) to be dropped form backup_ids_template + $key = new xmldb_key('backupid_itemname_itemid_uk', XMLDB_KEY_UNIQUE, array('backupid', 'itemname', 'itemid')); + // Define index backupid_parentitemid_ix (not unique) to be dropped form backup_ids_template + $index = new xmldb_index('backupid_parentitemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid', 'itemname', 'parentitemid')); + // Define field itemname to be 160cc + $field = new xmldb_field('itemname', XMLDB_TYPE_CHAR, '160', null, XMLDB_NOTNULL, null, null, 'backupid'); + + // Launch drop key backupid_itemname_itemid_uk + $dbman->drop_key($table, $key); + // Conditionally launch drop index backupid_parentitemid_ix + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + + // Changing precision of field itemname on table backup_ids_template to (160) + $dbman->change_field_precision($table, $field); + + // Launch add key backupid_itemname_itemid_uk + $dbman->add_key($table, $key); + // Conditionally launch add index backupid_parentitemid_ix + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2010071700); + } + return true; } diff --git a/version.php b/version.php index 24c5fc32a38..a99ee5fde69 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 = 2010071600; // YYYYMMDD = date of the last version bump + $version = 2010071700; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 Preview 4+ (Build: 20100717)'; // Human-friendly version name -- 2.43.0