<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="blocks/search/db" VERSION="20080801" COMMENT="XMLDB file for Moodle search engine">
+<XMLDB PATH="blocks/search/db" VERSION="20070811" COMMENT="XMLDB file for Moodle search engine"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
<TABLES>
- <TABLE NAME="search_documents" COMMENT="table to store search index backups">
+ <TABLE NAME="block_search_documents" COMMENT="table to store search index backups">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="docid"/>
<FIELD NAME="docid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="doctype"/>
- <FIELD NAME="doctype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="'none'" SEQUENCE="false" ENUM="false" PREVIOUS="docid" NEXT="itemtype"/>
- <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" DEFAULT="''" SEQUENCE="false" ENUM="false" PREVIOUS="itemtype" NEXT="url"/>
- <FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="''" SEQUENCE="false" ENUM="false" PREVIOUS="title" NEXT="docdate"/>
+ <FIELD NAME="doctype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="none" SEQUENCE="false" ENUM="false" PREVIOUS="docid" NEXT="itemtype"/>
+ <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" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="updated"/>
-
<FIELD NAME="updated" TYPE="datetime" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="docdate" NEXT="courseid"/>
- <FIELD NAME="courseid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="updated" NEXT="groupid"/>
- <FIELD NAME="groupid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="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>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for block"/>
</KEYS>
<INDEXES>
<INDEX NAME="mdl_search_docid" UNIQUE="false" FIELDS="docid" NEXT="mdl_search_doctype"/>
-
<INDEX NAME="mdl_search_doctype" UNIQUE="false" FIELDS="doctype" PREVIOUS="mdl_search_docid" NEXT="mdl_search_itemtype"/>
<INDEX NAME="mdl_search_itemtype" UNIQUE="false" FIELDS="itemtype" PREVIOUS="mdl_search_doctype"/>
</INDEXES>
$table = new XMLDBTable('search_documents');
/// Drop it if it existed before
-
+
drop_table($table, true, false);
/// Adding fields to table search_documents
$table->addFieldInfo('url', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
$table->addFieldInfo('docdate', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
$table->addFieldInfo('updated', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
- $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
- $table->addFieldInfo('groupid', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
+ $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
+ $table->addFieldInfo('groupid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
/// Adding keys to table search_documents
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$result = $result && create_table($table);
}
+/// Rename table search_documents to block_search_documents and
+/// fix some defaults (MDL-10572)
+ if ($result && $oldversion < 2007081100) {
+
+ /// Define table search_documents to be renamed to block_search_documents
+ $table = new XMLDBTable('search_documents');
+
+ /// Launch rename table for block_search_documents
+ $result = $result && rename_table($table, 'block_search_documents');
+
+ /// Changing the default of field doctype on table block_search_documents to none
+ $table = new XMLDBTable('block_search_documents');
+ $field = new XMLDBField('doctype');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none', 'docid');
+
+ /// Launch change of default for field doctype
+ $result = $result && change_field_default($table, $field);
+
+ /// Changing the default of field itemtype on table block_search_documents to standard
+ $table = new XMLDBTable('block_search_documents');
+ $field = new XMLDBField('itemtype');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard', 'doctype');
+
+ /// Launch change of default for field itemtype
+ $result = $result && change_field_default($table, $field);
+
+ /// Changing the default of field title on table block_search_documents to drop it
+ $table = new XMLDBTable('block_search_documents');
+ $field = new XMLDBField('title');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'itemtype');
+
+ /// Launch change of default for field title
+ $result = $result && change_field_default($table, $field);
+
+ /// Changing the default of field url on table block_search_documents to drop it
+ $table = new XMLDBTable('block_search_documents');
+ $field = new XMLDBField('url');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'title');
+
+ /// Launch change of default for field url
+ $result = $result && change_field_default($table, $field);
+ }
+
return $result;
}