DROP TABLE IF EXISTS `%TABLE_PREFIX%api_key`;
CREATE TABLE `%TABLE_PREFIX%api_key` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`isactive` tinyint(1) NOT NULL DEFAULT '1',
`ipaddr` VARCHAR(16) NOT NULL,
`apikey` VARCHAR(255) NOT NULL,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `ipaddr` (`ipaddr`)
) ENGINE=MyISAM;
INSERT INTO `%TABLE_PREFIX%api_key` (`id`, `isactive`, `ipaddr`, `apikey`, `updated`, `created`) VALUES (1, 1, '192.168.1.5', 'siri!', NOW(), NOW());
DROP TABLE IF EXISTS `%TABLE_PREFIX%department`;
CREATE TABLE `%TABLE_PREFIX%department` (
`dept_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`tpl_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`email_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`autoresp_email_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`manager_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`dept_name` VARCHAR(32) NOT NULL DEFAULT '',
`dept_signature` VARCHAR(255) NOT NULL DEFAULT '',
`ispublic` tinyint(1) UNSIGNED NOT NULL DEFAULT '1',
`ticket_auto_response` tinyint(1) NOT NULL DEFAULT '1',
`message_auto_response` tinyint(1) NOT NULL DEFAULT '0',
`can_append_signature` tinyint(1) NOT NULL DEFAULT '1',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`dept_id`),
UNIQUE KEY `dept_name` (`dept_name`),
KEY `manager_id` (`manager_id`),
KEY `autoresp_email_id` (`autoresp_email_id`),
KEY `tpl_id` (`tpl_id`)
) ENGINE=MyISAM;
INSERT INTO `%TABLE_PREFIX%department` (`dept_id`, `tpl_id`, `email_id`, `autoresp_email_id`, `manager_id`, `dept_name`, `dept_signature`, `ispublic`, `ticket_auto_response`, `message_auto_response`, `can_append_signature`, `updated`, `created`) VALUES
(1, 0, 1, 0, 0, 'Support', 'Support Dept', 1, 1, 1, 1, NOW(), NOW()),
(2, 0, 1, 0, 0, 'Billing', 'Billing Dept', 1, 1, 1, 1, NOW(), NOW());
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_banlist`;
CREATE TABLE `%TABLE_PREFIX%email_banlist` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) NOT NULL DEFAULT '',
`submitter` VARCHAR(126) NOT NULL DEFAULT '',
`added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM;
INSERT INTO `%TABLE_PREFIX%email_banlist` (`id`, `email`, `submitter`, `added`) VALUES
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_template`;
CREATE TABLE `%TABLE_PREFIX%email_template` (
`tpl_id` INT(11) NOT NULL AUTO_INCREMENT,
`cfg_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`name` VARCHAR(32) NOT NULL DEFAULT '',
`notes` text,
`ticket_autoresp_subj` VARCHAR(255) NOT NULL DEFAULT '',
`ticket_autoresp_body` text NOT NULL,
`ticket_alert_subj` VARCHAR(255) NOT NULL DEFAULT '',
`ticket_alert_body` text NOT NULL,
`message_autoresp_subj` VARCHAR(255) NOT NULL DEFAULT '',
`message_autoresp_body` text NOT NULL,
`message_alert_subj` VARCHAR(255) NOT NULL DEFAULT '',
`message_alert_body` text NOT NULL,
`note_alert_subj` VARCHAR(255) NOT NULL,
`note_alert_body` text NOT NULL,
`assigned_alert_subj` VARCHAR(255) NOT NULL DEFAULT '',
`assigned_alert_body` text NOT NULL,
`ticket_overdue_subj` VARCHAR(255) NOT NULL DEFAULT '',
`ticket_overdue_body` text NOT NULL,
`ticket_overlimit_subj` VARCHAR(255) NOT NULL DEFAULT '',
`ticket_overlimit_body` text NOT NULL,
`ticket_reply_subj` VARCHAR(255) NOT NULL DEFAULT '',
`ticket_reply_body` text NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`tpl_id`),
KEY `cfg_id` (`cfg_id`),
FULLTEXT KEY `message_subj` (`ticket_reply_subj`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `%TABLE_PREFIX%groups`;
CREATE TABLE `%TABLE_PREFIX%groups` (
`group_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`group_enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT '1',
`group_name` VARCHAR(50) NOT NULL DEFAULT '',
`dept_access` VARCHAR(255) NOT NULL DEFAULT '',
`can_edit_tickets` tinyint(3) UNSIGNED NOT NULL DEFAULT '1',
`can_delete_tickets` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`can_close_tickets` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`can_transfer_tickets` tinyint(1) NOT NULL DEFAULT '1',
`can_ban_emails` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`can_manage_kb` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`group_id`),
KEY `group_active` (`group_enabled`)
) ENGINE=MyISAM;
INSERT INTO `%TABLE_PREFIX%groups` (`group_id`, `group_enabled`, `group_name`, `dept_access`, `can_edit_tickets`, `can_delete_tickets`, `can_close_tickets`, `can_transfer_tickets`, `can_ban_emails`, `can_manage_kb`, `created`, `updated`) VALUES
(1, 1, 'Admins', '1', 1, 1, 1, 1, 1, 1, NOW(), NOW()),
(2, 1, 'Managers', '1', 1, 0, 1, 1, 1, 1, NOW(), NOW()),
(3, 1, 'Staff', '1', 0, 0, 0, 0, 0, 0, NOW(), NOW());
DROP TABLE IF EXISTS `%TABLE_PREFIX%help_topic`;
CREATE TABLE `%TABLE_PREFIX%help_topic` (
`topic_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`isactive` tinyint(1) UNSIGNED NOT NULL DEFAULT '1',
`noautoresp` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
`priority_id` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
`dept_id` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
`topic` VARCHAR(32) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`topic_id`),
UNIQUE KEY `topic` (`topic`),
KEY `priority_id` (`priority_id`),
KEY `dept_id` (`dept_id`)
) ENGINE=MyISAM;
INSERT INTO `%TABLE_PREFIX%help_topic` (`topic_id`, `isactive`, `noautoresp`, `priority_id`, `dept_id`, `topic`, `created`, `updated`) VALUES
(1, 1, 0, 2, 1, 'Support', NOW(), NOW()),
(2, 1, 0, 3, 1, 'Billing', NOW(), NOW());
DROP TABLE IF EXISTS `%TABLE_PREFIX%kb_premade`;
CREATE TABLE `%TABLE_PREFIX%kb_premade` (
`premade_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`dept_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`isenabled` tinyint(1) UNSIGNED NOT NULL DEFAULT '1',
`title` VARCHAR(125) NOT NULL DEFAULT '',
`answer` text NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`premade_id`),
UNIQUE KEY `title_2` (`title`),
KEY `dept_id` (`dept_id`),
KEY `active` (`isenabled`),
FULLTEXT KEY `title` (`title`,`answer`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `%TABLE_PREFIX%syslog`;
CREATE TABLE `%TABLE_PREFIX%syslog` (
`log_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`log_type` enum('Debug','Warning','Error') NOT NULL,
`title` VARCHAR(255) NOT NULL,
`log` text NOT NULL,
`logger` VARCHAR(64) NOT NULL,
`ip_address` VARCHAR(16) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`log_id`),
KEY `log_type` (`log_type`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `%TABLE_PREFIX%ticket`;
CREATE TABLE `%TABLE_PREFIX%ticket` (
`ticket_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ticketID` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`dept_id` INT(10) UNSIGNED NOT NULL DEFAULT '1',
`priority_id` INT(10) UNSIGNED NOT NULL DEFAULT '2',
`staff_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`email` VARCHAR(120) NOT NULL DEFAULT '',
`name` VARCHAR(32) NOT NULL DEFAULT '',
`subject` VARCHAR(64) NOT NULL DEFAULT '[no subject]',
`topic` VARCHAR(64) DEFAULT NULL,
`phone` VARCHAR(16) DEFAULT NULL,
`phone_ext` VARCHAR(8) DEFAULT NULL,
`ip_address` VARCHAR(16) NOT NULL DEFAULT '',
`status` enum('open','closed') NOT NULL DEFAULT 'open',
`source` enum('Web','Email','Phone','Other') NOT NULL DEFAULT 'Other',
`isoverdue` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`isanswered` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
`duedate` datetime DEFAULT NULL,
`reopened` datetime DEFAULT NULL,
`closed` datetime DEFAULT NULL,
`lastmessage` datetime DEFAULT NULL,
`lastresponse` datetime DEFAULT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`ticket_id`),
UNIQUE KEY `email_extid` (`ticketID`,`email`),
KEY `dept_id` (`dept_id`),
KEY `staff_id` (`staff_id`),
KEY `status` (`status`),
KEY `priority_id` (`priority_id`),
KEY `created` (`created`),
KEY `closed` (`closed`),
KEY `duedate` (`duedate`)
) ENGINE=MyISAM;