function casetracker_install in Case Tracker 5
Same name and namespace in other branches
- 6 casetracker.install \casetracker_install()
- 7.2 casetracker.install \casetracker_install()
- 7 casetracker.install \casetracker_install()
Implementation of hook_install().
Database schema last updated 2007-11 by zero2one.
casetracker_case: nid: corresponding node ID of this case item. vid: corresponding revision ID of the node ID. pid: the project ID this case has been assigned to. case_number: the case number of this node (namespaced per projects). assign_to: the user ID this case has been assigned to. case_priority_id: the priority ID this case has been set to. case_type_id: the type ID this case has been set to. case_status_id: the status ID this case has been set to.
casetracker_case_states: csid: the unique ID of this case state. case_state_name: the name of this case state. case_state_realm: the realm ('priority', etc.) of this state. weight: the weight of an case (order for display purpose).
casetracker_comment_status: cid: comment ID as defined by core comment table. pid: the project ID (before or after) of this comment/case. title: the case title (before or after) of this comment/case. assign_to: the user ID (before or after) of this comment/case. case_priority_id: the priority ID (before or after) of this comment/case. case_type_id: the case ID (before or after) of this comment/case. case_status_id: the status ID (before or after) of this comment/case. state: if 0, this is data for "before" the comment; 1 is "after".
casetracker_project: project_number: the case tracker-created project number of this project. nid: the node ID to which this project corresponds to. vid: the revision ID of the node ID this project corresponds to.
File
- ./
casetracker.install, line 39
Code
function casetracker_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {casetracker_case} (\n nid int(10) NOT NULL default '0',\n vid int(10) NOT NULL default '0',\n pid int(10) NOT NULL default '0',\n case_number int(10) NOT NULL default '0',\n assign_to int(10) NOT NULL default '0',\n case_priority_id int(5) NOT NULL default '0',\n case_type_id int(5) NOT NULL default '0',\n case_status_id int(5) NOT NULL default '0',\n PRIMARY KEY (vid),\n KEY nid (nid),\n KEY pid (pid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {casetracker_case_states} (\n csid tinyint(3) NOT NULL auto_increment,\n case_state_name varchar(255) NOT NULL,\n case_state_realm varchar(255) NOT NULL,\n weight tinyint(4) NOT NULL default '0',\n PRIMARY KEY (csid),\n KEY weight (weight)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
db_query("CREATE TABLE {casetracker_comment_status} (\n cid int(10) NOT NULL default '0',\n pid int(10) NOT NULL default '0',\n title varchar(250) default NULL,\n assign_to int(10) NOT NULL default '0',\n case_priority_id int(10) NOT NULL default '0',\n case_type_id int(10) NOT NULL default '0',\n case_status_id int(10) NOT NULL default '0',\n state int(10) NOT NULL default '0'\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {casetracker_project} (\n project_number int(10) NOT NULL default '0',\n nid int(10) NOT NULL default '0',\n vid int(10) NOT NULL default '0',\n UNIQUE KEY vid (vid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('1-High', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('2', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('3', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('4', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('5-Low', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Open', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Closed', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Resolved-Staging', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Resolved-Production', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Tested Staging', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Bug', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Feature Request', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Text Modification', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('General Task', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Suggestion', 'type')");
break;
case 'pgsql':
db_query("CREATE TABLE {casetracker_case} (\n nid INTEGER NOT NULL default '0',\n vid INTEGER NOT NULL default '0',\n pid INTEGER NOT NULL default '0',\n case_number INTEGER NOT NULL default '0',\n assign_to INTEGER NOT NULL default '0',\n case_priority_id INTEGER NOT NULL default '0',\n case_type_id INTEGER NOT NULL default '0',\n case_status_id INTEGER NOT NULL default '0',\n PRIMARY KEY (vid)\n )");
db_query("CREATE TABLE {casetracker_case_states} (\n csid SERIAL,\n case_state_name VARCHAR(255) NOT NULL,\n case_state_realm VARCHAR(255) NOT NULL,\n weight numeric(4) NOT NULL default 0,\n PRIMARY KEY (csid)\n )");
db_query("CREATE TABLE {casetracker_comment_status} (\n cid INTEGER NOT NULL default '0',\n pid INTEGER NOT NULL default '0',\n title VARCHAR(250) default NULL,\n assign_to INTEGER NOT NULL default '0',\n case_priority_id INTEGER NOT NULL default '0',\n case_type_id INTEGER NOT NULL default '0',\n case_status_id INTEGER NOT NULL default '0',\n state INTEGER NOT NULL default '0'\n )");
db_query("CREATE TABLE {casetracker_project} (\n project_number INTEGER NOT NULL default '0',\n nid INTEGER NOT NULL default '0',\n vid INTEGER NOT NULL default '0',\n UNIQUE (vid)\n )");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('1-High', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('2', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('3', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('4', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('5-Low', 'priority')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Open', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Closed', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Resolved-Staging', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Resolved-Production', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Tested Staging', 'status')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Bug', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Feature Request', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Text Modification', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('General Task', 'type')");
db_query("INSERT INTO {casetracker_case_states} (case_state_name, case_state_realm) VALUES ('Suggestion', 'type')");
break;
}
}