function user_badges_install in User Badges 5
Same name and namespace in other branches
- 6.2 user_badges.install \user_badges_install()
- 6 user_badges.install \user_badges_install()
- 7.4 user_badges.install \user_badges_install()
Implementation of hook_install()
File
- ./
user_badges.install, line 23 - @brief User Badges install file
Code
function user_badges_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {user_badges_badges} (\n bid int(10) NOT NULL default '0',\n name varchar(50) NOT NULL default '',\n image varchar(80) NOT NULL default '',\n weight int(2) NOT NULL default '0',\n href VARCHAR(80) default '',\n PRIMARY KEY (bid)\n )");
db_query("CREATE TABLE {user_badges_product} (\n bid int(10) NOT NULL default '0',\n nid int(10) NOT NULL default '0'\n )");
db_query("CREATE TABLE {user_badges_roles} (\n rid int(10) NOT NULL default '0',\n bid int(10) NOT NULL default '0'\n )");
db_query("CREATE TABLE {user_badges_user} (\n uid int(10) NOT NULL default '0',\n bid int(10) NOT NULL default '0',\n type varchar(20) NOT NULL default ''\n )");
break;
case 'pgsql':
db_query("CREATE TABLE {user_badges_badges} (\n bid int NOT NULL default '0',\n name varchar(50) NOT NULL default '',\n image varchar(80) NOT NULL default '',\n weight int NOT NULL default '0',\n href VARCHAR(80) NULL default '',\n PRIMARY KEY (bid)\n ); ");
db_query("CREATE SEQUENCE {user_badges_badges}_seq");
db_query("CREATE TABLE {user_badges_product} (\n bid int NOT NULL default '0',\n nid int NOT NULL default '0'\n ); ");
db_query("CREATE TABLE {user_badges_roles} (\n rid int NOT NULL default '0',\n bid int NOT NULL default '0'\n ); ");
db_query("CREATE TABLE {user_badges_user} (\n uid int NOT NULL default '0',\n bid int NOT NULL default '0',\n type varchar(20) NOT NULL default ''\n ); ");
break;
default:
break;
}
}