View source
<?php
function answers_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {answers} (\n qid int(11) NOT NULL default '0',\n nid int(11) NOT NULL default '0',\n uid int(11) NOT NULL default '0',\n Status tinyint(1) NOT NULL default '0',\n relationscore int(2) NOT NULL default '0',\n PRIMARY KEY (qid,uid, nid),\n KEY answers_uid (uid),\n KEY answers_nid (nid),\n KEY answers_qid (qid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {quests} (\n vid int(11) NOT NULL default '0',\n nid int(11) NOT NULL default '0',\n notifyme tinyint(1) NOT NULL default '0',\n answeranon tinyint(1) NOT NULL default '0',\n PRIMARY KEY (vid,nid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {answers} (\n qid int_unsigned NOT NULL default 0,\n nid int_unsigned NOT NULL default 0,\n uid int_unsigned NOT NULL default 0,\n Status int_unsigned NOT NULL default 0,\n relationscore int NOT NULL default 0,\n PRIMARY KEY (qid,uid, nid),\n KEY answers_uid (uid),\n KEY answers_nid (nid),\n KEY answers_qid (qid)\n )");
db_query("CREATE TABLE {quests} (\n vid int_unsigned NOT NULL default 0,\n nid int_unsigned NOT NULL default 0,\n notifyme int_unsigned NOT NULL default 0,\n answeranon int_unsigned NOT NULL default 0,\n PRIMARY KEY (vid,nid)\n )");
break;
}
}
function answers_uninstall() {
db_query('DROP TABLE {answers}');
db_query('DROP TABLE {quests}');
}