Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / blocks / search / db / upgrade.php
blob61d70ecaf8ed2c9faadd79f72fe018470a9a0c96
1 <?php //$Id$
3 // This file keeps track of upgrades to
4 // the search block
5 //
6 // Sometimes, changes between versions involve
7 // alterations to database structures and other
8 // major things that may break installations.
9 //
10 // The upgrade function in this file will attempt
11 // to perform all the necessary actions to upgrade
12 // your older installtion to the current version.
14 // If there's something it cannot do itself, it
15 // will tell you what you need to do.
17 // The commands in here will all be database-neutral,
18 // using the functions defined in lib/ddllib.php
20 function xmldb_block_search_upgrade($oldversion=0) {
22 global $CFG, $THEME, $db;
24 $result = true;
26 /// And upgrade begins here. For each one, you'll need one
27 /// block of code similar to the next one. Please, delete
28 /// this comment lines once this file start handling proper
29 /// upgrade code.
31 /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
32 /// $result = result of "/lib/ddllib.php" function calls
33 /// }
34 if ($result && $oldversion < 2007071302) {
36 /// Define table search_documents to be created
37 $table = new XMLDBTable('search_documents');
39 /// Drop it if it existed before
41 drop_table($table, true, false);
43 /// Adding fields to table search_documents
44 $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
45 $table->addFieldInfo('docid', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null);
46 $table->addFieldInfo('doctype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'none');
47 $table->addFieldInfo('itemtype', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'standard');
48 $table->addFieldInfo('title', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
49 $table->addFieldInfo('url', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null);
50 $table->addFieldInfo('docdate', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
51 $table->addFieldInfo('updated', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL, null, null, null);
52 $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
53 $table->addFieldInfo('groupid', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
55 /// Adding keys to table search_documents
56 $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
58 /// Adding indexes to table search_documents
59 $table->addIndexInfo('mdl_search_docid', XMLDB_INDEX_NOTUNIQUE, array('docid'));
60 $table->addIndexInfo('mdl_search_doctype', XMLDB_INDEX_NOTUNIQUE, array('doctype'));
61 $table->addIndexInfo('mdl_search_itemtype', XMLDB_INDEX_NOTUNIQUE, array('itemtype'));
63 /// Launch create table for search_documents
64 $result = $result && create_table($table);
67 return $result;