Skip to content
Browse files

MDL-30521 blog: Updated uniquehash field preceision to 255 in post table

  • Loading branch information...
1 parent 52e6baa commit 2f20a794bf48f0aed1297ee82ab4cdf7b4d6a131 @rajeshtaneja rajeshtaneja committed Feb 14, 2012
Showing with 19 additions and 21 deletions.
  1. +1 −1 lib/db/install.xml
  2. +17 −19 lib/db/upgrade.php
  3. +1 −1 version.php
View
2 lib/db/install.xml
@@ -985,7 +985,7 @@
<FIELD NAME="subject" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" PREVIOUS="coursemoduleid" NEXT="summary"/>
<FIELD NAME="summary" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="subject" NEXT="content"/>
<FIELD NAME="content" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="summary" NEXT="uniquehash"/>
- <FIELD NAME="uniquehash" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" PREVIOUS="content" NEXT="rating"/>
+ <FIELD NAME="uniquehash" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="content" NEXT="rating"/>
<FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="uniquehash" NEXT="format"/>
<FIELD NAME="format" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="rating" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="format" NEXT="attachment"/>
View
36 lib/db/upgrade.php
@@ -5444,7 +5444,7 @@ function xmldb_main_upgrade($oldversion) {
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);
@@ -5790,24 +5790,6 @@ function xmldb_main_upgrade($oldversion) {
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');
@@ -6724,6 +6706,22 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2011070103.04);
}
+ if ($oldversion < 2011070104.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, 2011070104.07);
+ }
return true;
}
View
2 version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2011070104.06; // 20110701 = branching date YYYYMMDD - do not modify!
+$version = 2011070104.07; // 20110701 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit 2f20a79

Please sign in to comment.
Something went wrong with that request. Please try again.