]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12352, block/search fails to install on postgres
authortoyomoyo <toyomoyo>
Tue, 27 Nov 2007 05:43:27 +0000 (05:43 +0000)
committertoyomoyo <toyomoyo>
Tue, 27 Nov 2007 05:43:27 +0000 (05:43 +0000)
blocks/search/block_search.php
blocks/search/db/install.xml
blocks/search/db/upgrade.php

index f75fa1668ef6559bd93d8b42f68bb21d72428706..cfc2fd26d07608939ffd987f3c010f51a5db326f 100644 (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
index d71fd70847055e6903773f46c39f01f74ca29fe9..234e77e1479863f48c74984fcb694fc382fd8a11 100644 (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>
index d9d5d856bd08283ce28ecc9a3c4ea89a7cb46bc9..7eece96a31c0db4cf224d8e19d920b066490c2e0 100644 (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;
 }
 
-?>
+?>
\ No newline at end of file