diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index aee14bd6b26..523aae4930f 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -5082,51 +5082,6 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2010082502); } - if ($oldversion < 2010091300) { - // 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 - $table = new xmldb_table('block_instances'); - $index = new xmldb_index('parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern', XMLDB_INDEX_NOTUNIQUE, array('parentcontextid', 'showinsubcontexts', 'pagetypepattern', 'subpagepattern')); - - // 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, 2010091300); - } - - if ($oldversion < 2010091301) { - - // Changing precision of field pagetypepattern on table block_instances to (64) - $table = new xmldb_table('block_instances'); - $field = new xmldb_field('pagetypepattern', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null, 'showinsubcontexts'); - - // Launch change of precision for field pagetypepattern - $dbman->change_field_precision($table, $field); - - // Main savepoint reached - upgrade_main_savepoint(true, 2010091301); - } - - if ($oldversion < 2010091302) { - // Now add the index back. - - // Define index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern (not unique) to be added to block_instances - $table = new xmldb_table('block_instances'); - $index = new xmldb_index('parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern', XMLDB_INDEX_NOTUNIQUE, array('parentcontextid', 'showinsubcontexts', 'pagetypepattern', 'subpagepattern')); - - // Conditionally launch add index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern - if (!$dbman->index_exists($table, $index)) { - $dbman->add_index($table, $index); - } - - // Main savepoint reached - upgrade_main_savepoint(true, 2010091302); - } - if ($oldversion < 2010091303) { // drop all test tables from old xmldb test suite $table = new xmldb_table('testtable'); @@ -5157,6 +5112,68 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2010091500); } + if ($oldversion < 2010091501) { + // 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 pagetypepattern (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 pagetypepattern + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2010091501); + } + + if ($oldversion < 2010091502) { + // 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 + $table = new xmldb_table('block_instances'); + $index = new xmldb_index('parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern', XMLDB_INDEX_NOTUNIQUE, array('parentcontextid', 'showinsubcontexts', 'pagetypepattern', 'subpagepattern')); + + // 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, 2010091502); + } + + if ($oldversion < 2010091503) { + + // Changing precision of field pagetypepattern on table block_instances to (64) + $table = new xmldb_table('block_instances'); + $field = new xmldb_field('pagetypepattern', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null, 'showinsubcontexts'); + + // Launch change of precision for field pagetypepattern + $dbman->change_field_precision($table, $field); + + // Main savepoint reached + upgrade_main_savepoint(true, 2010091503); + } + + if ($oldversion < 2010091504) { + // Now add the index back. + + // Define index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern (not unique) to be added to block_instances + $table = new xmldb_table('block_instances'); + $index = new xmldb_index('parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern', XMLDB_INDEX_NOTUNIQUE, array('parentcontextid', 'showinsubcontexts', 'pagetypepattern', 'subpagepattern')); + + // Conditionally launch add index parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2010091504); + } + return true; } diff --git a/version.php b/version.php index 3bdf1eacc36..334a1d49109 100644 --- a/version.php +++ b/version.php @@ -29,8 +29,8 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2010091500; // YYYYMMDD = date of the last version bump +$version = 2010091504; // YYYYMMDD = date of the last version bump // XX = daily increments -$release = '2.0 Preview 4+ (Build: 20100915)'; // Human-friendly version name +$release = '2.0 Preview 4+ (Build: 20100913)'; // Human-friendly version name