From: toyomoyo Date: Tue, 27 Nov 2007 05:43:27 +0000 (+0000) Subject: MDL-12352, block/search fails to install on postgres X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3b2274ce5f290f0f271333891b8ffbfdb0d1d879;p=moodle.git MDL-12352, block/search fails to install on postgres --- diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php index f75fa1668e..cfc2fd26d0 100644 --- a/blocks/search/block_search.php +++ b/blocks/search/block_search.php @@ -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 diff --git a/blocks/search/db/install.xml b/blocks/search/db/install.xml index d71fd70847..234e77e147 100644 --- a/blocks/search/db/install.xml +++ b/blocks/search/db/install.xml @@ -12,8 +12,8 @@ - - + + diff --git a/blocks/search/db/upgrade.php b/blocks/search/db/upgrade.php index d9d5d856bd..7eece96a31 100644 --- a/blocks/search/db/upgrade.php +++ b/blocks/search/db/upgrade.php @@ -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