From 83e83887e310fd117363cd7ddb78f7343b755b67 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 14 Feb 2012 14:17:16 +0800 Subject: [PATCH] MDL-30521 blog: Updated uniquehash field preceision to 255 in post table --- lib/db/install.xml | 2 +- lib/db/upgrade.php | 36 +++++++++++++++++------------------- version.php | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index 3d7b40e9ef6..a7c620f4b1d 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -987,7 +987,7 @@ - + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index caca96abd47..1928fae570f 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -5402,7 +5402,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); if ($oldversion < 2010102700) { $table = new xmldb_table('post'); - $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, 'content'); + $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'content'); // Launch change of precision for field name $dbman->change_field_precision($table, $field); @@ -5748,24 +5748,6 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2011011406); } - if ($oldversion < 2011011407) { - // Check if we need to fix post.uniquehash - $columns = $DB->get_columns('my_pages'); - if (array_key_exists('uniquehash', $columns) && $columns['uniquehash']->max_length != 128) { - // Fix discrepancies in the post table after upgrade from 1.9 - $table = new xmldb_table('post'); - - // Uniquehash should be 128 chars - // Fixed in earlier upgrade code - $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, 128, null, XMLDB_NOTNULL, null, null, 'content'); - if ($dbman->field_exists($table, $field)) { - $dbman->change_field_precision($table, $field); - } - } - - upgrade_main_savepoint(true, 2011011407); - } - if ($oldversion < 2011011408) { // Fix question in the post table after upgrade from 1.9 $columns = $DB->get_columns('question'); @@ -6992,6 +6974,22 @@ FROM upgrade_main_savepoint(true, 2011120500.03); } + if ($oldversion < 2011120501.07) { + // Check if we need to fix post.uniquehash + $columns = $DB->get_columns('post'); + if (array_key_exists('uniquehash', $columns) && $columns['uniquehash']->max_length != 255) { + // Fix discrepancies in the post table after upgrade from 1.9 + $table = new xmldb_table('post'); + + // Uniquehash should be 255 chars, fixed in earlier upgrade code + $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, null, 'content'); + if ($dbman->field_exists($table, $field)) { + $dbman->change_field_precision($table, $field); + } + } + + upgrade_main_savepoint(true, 2011120501.07); + } return true; } diff --git a/version.php b/version.php index 4f51fc5088d..56c43ce683f 100644 --- a/version.php +++ b/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2011120501.06; // 20111205 = branching date YYYYMMDD - do not modify! +$version = 2011120501.07; // 20111205 = branching date YYYYMMDD - do not modify! // RR = release increments - 00 in DEV branches // .XX = incremental changes