| 1 |
<?php
|
| 2 |
// $Id:$
|
| 3 |
|
| 4 |
function relativity_install() {
|
| 5 |
switch ($GLOBALS['db_type']) {
|
| 6 |
case 'mysql':
|
| 7 |
case 'mysqli':
|
| 8 |
db_query("CREATE TABLE {relativity} (
|
| 9 |
nid int(10) unsigned NOT NULL default '0',
|
| 10 |
parent_nid int(10) unsigned NOT NULL default '0',
|
| 11 |
KEY nid (nid),
|
| 12 |
KEY parent_nid (nid)
|
| 13 |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 14 |
|
| 15 |
db_query("CREATE TABLE {relativity_query} (
|
| 16 |
nid int(10) unsigned NOT NULL default '0',
|
| 17 |
target_nid int(10) unsigned,
|
| 18 |
follow_parents int(10) unsigned,
|
| 19 |
follow_children int(10) unsigned,
|
| 20 |
recursion_depth int(10) unsigned,
|
| 21 |
unique_types int(10) unsigned,
|
| 22 |
max_results int(10) unsigned,
|
| 23 |
options longtext,
|
| 24 |
search_algorithm varchar(20) default 'dfs',
|
| 25 |
search_types longtext,
|
| 26 |
end_pts longtext,
|
| 27 |
avoid_pts longtext,
|
| 28 |
KEY nid (nid)
|
| 29 |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 30 |
|
| 31 |
break;
|
| 32 |
|
| 33 |
/*
|
| 34 |
case 'pgsql':
|
| 35 |
break;
|
| 36 |
*/
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|
| 40 |
function relativity_update_1() {
|
| 41 |
return _system_update_utf8(array('relativity', 'relativity_query'));
|
| 42 |
}
|
| 43 |
|
| 44 |
function relativity_update_2() {
|
| 45 |
$items = array();
|
| 46 |
$items[] = update_sql("ALTER TABLE relativity DROP INDEX parent_nid,
|
| 47 |
ADD INDEX parent_nid (parent_nid)");
|
| 48 |
return $items;
|
| 49 |
}
|
| 50 |
|
| 51 |
function relativity_uninstall() {
|
| 52 |
switch ($GLOBALS['db_type']) {
|
| 53 |
case 'mysql':
|
| 54 |
case 'mysqli':
|
| 55 |
db_query("DROP TABLE {relativity}");
|
| 56 |
db_query("DROP TABLE {relativity_query}");
|
| 57 |
break;
|
| 58 |
}
|
| 59 |
}
|