MDL-12352, block/search fails to install on postgres

This commit is contained in:
toyomoyo
2007-11-27 05:30:10 +00:00
parent dab7fce2aa
commit 430196f1a0
3 changed files with 26 additions and 4 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
function init() {
$this->title = get_string('blockname', 'block_search');
$this->cron = 1;
$this->version = 2007081100;
$this->version = 2007112700;
} //init
// only one instance of this block is required
+2 -2
View File
@@ -12,8 +12,8 @@
<FIELD NAME="itemtype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="standard" SEQUENCE="false" ENUM="false" PREVIOUS="doctype" NEXT="title"/>
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemtype" NEXT="url"/>
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="title" NEXT="docdate"/>
<FIELD NAME="docdate" TYPE="datetime" NOTNULL="true" DEFAULT="'0000-00-00 00:00:00'" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="updated"/>
<FIELD NAME="updated" TYPE="datetime" NOTNULL="true" DEFAULT="'0000-00-00 00:00:00'" SEQUENCE="false" ENUM="false" PREVIOUS="docdate" NEXT="courseid"/>
<FIELD NAME="docdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="updated"/>
<FIELD NAME="updated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="docdate" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="updated" NEXT="groupid"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid"/>
</FIELDS>
+23 -1
View File
@@ -107,7 +107,29 @@ function xmldb_block_search_upgrade($oldversion=0) {
$result = $result && change_field_default($table, $field);
}
if ($result && $oldversion < 2007112700) {
/// Truncate the block_search_documents table
execute_sql("TRUNCATE TABLE {$CFG->prefix}block_search_documents", true);
/// Changing type of field docdate on table block_search_documents to int
$table = new XMLDBTable('block_search_documents');
$field = new XMLDBField('docdate');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'url');
/// Launch change of type for field docdate
$result = $result && change_field_type($table, $field);
/// Changing type of field updated on table block_search_documents to int
$table = new XMLDBTable('block_search_documents');
$field = new XMLDBField('updated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'docdate');
/// Launch change of type for field updated
$result = $result && change_field_type($table, $field);
}
return $result;
}
?>
?>