Skip to content

Commit

Permalink
MDL-12352, block/search fails to install on postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Dec 6, 2007
1 parent 6806fff commit 4affe94
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions blocks/search/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function xmldb_block_search_upgrade($oldversion=0) {

if ($result && $oldversion < 2007112700) {

/*
/// Truncate the block_search_documents table
execute_sql("TRUNCATE TABLE {$CFG->prefix}block_search_documents", true);
Expand All @@ -127,6 +128,38 @@ function xmldb_block_search_upgrade($oldversion=0) {
/// Launch change of type for field updated
$result = $result && change_field_type($table, $field);
*/


/// MDL-12352, postgres can not cope with change_field_type(), so dropping the fields and adding again

/// Define field docdate to be dropped from block_search_documents
$table = new XMLDBTable('block_search_documents');
$field = new XMLDBField('docdate');

/// Launch drop field docdate
$result = $result && drop_field($table, $field);

/// Define field updated to be dropped from block_search_documents
$field = new XMLDBField('updated');

/// Launch drop field updated
$result = $result && drop_field($table, $field);

/// Define field docdate to be added to block_search_documents
$field = new XMLDBField('docdate');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'url');

/// Launch add field docdate
$result = $result && add_field($table, $field);

/// Define field updated to be added to block_search_documents
$field = new XMLDBField('updated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'docdate');

/// Launch add field updated
$result = $result && add_field($table, $field);

}

return $result;
Expand Down

0 comments on commit 4affe94

Please sign in to comment.