Index: lib/db/upgrade.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/db/upgrade.php,v retrieving revision 1.480 diff -u -r1.480 upgrade.php --- lib/db/upgrade.php 13 Sep 2010 13:01:34 -0000 1.480 +++ lib/db/upgrade.php 15 Sep 2010 09:48:56 -0000 @@ -5082,7 +5082,24 @@ upgrade_main_savepoint(true, 2010082502); } - if ($oldversion < 2010091300) { + if ($oldversion < 2010091500) { + // This index used to exist in Moodle 1.9 and was never dropped in the upgrade above. + // Drop it now, or it breaks the following alter column. + + // Define index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern (not unique) to be dropped form block_instances + $table = new xmldb_table('block_instances'); + $index = new xmldb_index('pagetypepattern', XMLDB_INDEX_NOTUNIQUE, array('pagetypepattern')); + + // Conditionally launch drop index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2010091500); + } + + if ($oldversion < 2010091501) { // Need to drop the index before we can alter the column precision in the next step. // Define index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern (not unique) to be dropped form block_instances @@ -5095,10 +5112,10 @@ } // Main savepoint reached - upgrade_main_savepoint(true, 2010091300); + upgrade_main_savepoint(true, 2010091501); } - if ($oldversion < 2010091301) { + if ($oldversion < 2010091502) { // Changing precision of field pagetypepattern on table block_instances to (64) $table = new xmldb_table('block_instances'); @@ -5108,10 +5125,10 @@ $dbman->change_field_precision($table, $field); // Main savepoint reached - upgrade_main_savepoint(true, 2010091301); + upgrade_main_savepoint(true, 2010091502); } - if ($oldversion < 2010091302) { + if ($oldversion < 2010091503) { // Now add the index back. // Define index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern (not unique) to be added to block_instances @@ -5124,7 +5141,7 @@ } // Main savepoint reached - upgrade_main_savepoint(true, 2010091302); + upgrade_main_savepoint(true, 2010091503); } return true; Index: version.php =================================================================== RCS file: /cvsroot/moodle/moodle/version.php,v retrieving revision 1.1750 diff -u -r1.1750 version.php --- version.php 13 Sep 2010 13:01:35 -0000 1.1750 +++ version.php 15 Sep 2010 09:48:55 -0000 @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2010091302; // YYYYMMDD = date of the last version bump +$version = 2010091503; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 Preview 4+ (Build: 20100913)'; // Human-friendly version name