function search_install in Drupal 5
Same name and namespace in other branches
- 6 modules/search/search.install \search_install()
Implementation of hook_install().
File
- modules/
search/ search.install, line 6
Code
function search_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {search_dataset} (\n sid int unsigned NOT NULL default '0',\n type varchar(16) default NULL,\n data longtext NOT NULL,\n KEY sid_type (sid, type)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {search_index} (\n word varchar(50) NOT NULL default '',\n sid int unsigned NOT NULL default '0',\n type varchar(16) default NULL,\n fromsid int unsigned NOT NULL default '0',\n fromtype varchar(16) default NULL,\n score float default NULL,\n KEY sid_type (sid, type),\n KEY from_sid_type (fromsid, fromtype),\n KEY word (word)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {search_total} (\n word varchar(50) NOT NULL default '',\n count float default NULL,\n PRIMARY KEY (word)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
db_query("CREATE TABLE {search_dataset} (\n sid int_unsigned NOT NULL default '0',\n type varchar(16) default NULL,\n data text NOT NULL\n )");
db_query("CREATE INDEX {search_dataset}_sid_type_idx ON {search_dataset} (sid, type)");
db_query("CREATE TABLE {search_index} (\n word varchar(50) NOT NULL default '',\n sid int_unsigned NOT NULL default '0',\n type varchar(16) default NULL,\n fromsid int_unsigned NOT NULL default '0',\n fromtype varchar(16) default NULL,\n score float default NULL\n )");
db_query("CREATE INDEX {search_index}_sid_type_idx ON {search_index} (sid, type)");
db_query("CREATE INDEX {search_index}_from_sid_type_idx ON {search_index} (fromsid, fromtype)");
db_query("CREATE INDEX {search_index}_word_idx ON {search_index} (word)");
db_query("CREATE TABLE {search_total} (\n word varchar(50) NOT NULL default '',\n count float default NULL,\n PRIMARY KEY (word)\n )");
break;
}
}