mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-11 17:59:03 +00:00
Changed database all ID's to Unsigned, also added ticket_log table + started working on the class file
This commit is contained in:
parent
fe0366c2a9
commit
1f8ed0b845
6 changed files with 372 additions and 223 deletions
|
@ -0,0 +1,93 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Ticket_Log{
|
||||||
|
|
||||||
|
private $tCategoryId;
|
||||||
|
private $name;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//Creates a ticket_Catergory in the DB
|
||||||
|
public static function createTicketCategory( $name) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "INSERT INTO ticket_category (Name) VALUES (:name)";
|
||||||
|
$values = Array('name' => $name);
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return constructed element based on TCategoryId
|
||||||
|
public static function constr_TCategoryId( $id) {
|
||||||
|
$instance = new self();
|
||||||
|
$instance->setTCategoryId($id);
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns list of all category objects
|
||||||
|
public static function getAllCategories() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT * FROM ticket_category");
|
||||||
|
$row = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($row as $category){
|
||||||
|
$instance = new self();
|
||||||
|
$instance->tCategoryId = $category['TCategoryId'];
|
||||||
|
$instance->name = $category['Name'];
|
||||||
|
$result[] = $instance;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//return constructed element based on TCategoryId
|
||||||
|
public function load_With_TCategoryId( $id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->tCategoryId = $row['TCategoryId'];
|
||||||
|
$this->name = $row['Name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update private data to DB.
|
||||||
|
public function update(){
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "UPDATE ticket_category SET Name = :name WHERE TCategoryId=:id";
|
||||||
|
$values = Array('id' => $this->tCategoryId, 'name' => $this->name);
|
||||||
|
$statement = $dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
if ($this->name == ""){
|
||||||
|
$this->load_With_TCategoryId($this->tCategoryId);
|
||||||
|
}
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getTCategoryId(){
|
||||||
|
return $this->tCategoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setName($n){
|
||||||
|
$this->name = $n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTCategoryId($id){
|
||||||
|
$this->tCategoryId = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -12,11 +12,11 @@ function reply_on_ticket(){
|
||||||
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){
|
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
if(isset($_POST['ChangeStatus']) && $_POST['Content'] != ""){
|
||||||
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
||||||
$author = $_SESSION['ticket_user']->getTUserId();
|
$author = $_SESSION['ticket_user']->getTUserId();
|
||||||
Ticket_Reply::createReply($content, $author, $ticket_id);
|
Ticket_Reply::createReply($content, $author, $ticket_id);
|
||||||
|
}
|
||||||
if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && WebUsers::isAdmin()){
|
if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && WebUsers::isAdmin()){
|
||||||
$newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
|
$newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
$newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT);
|
$newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 110 KiB |
|
@ -45,19 +45,19 @@
|
||||||
`query` VARCHAR( 512 ) NOT NULL
|
`query` VARCHAR( 512 ) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_category`
|
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_category`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (
|
||||||
`TCategoryId` INT NOT NULL AUTO_INCREMENT ,
|
`TCategoryId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Name` VARCHAR(45) NOT NULL ,
|
`Name` VARCHAR(45) NOT NULL ,
|
||||||
PRIMARY KEY (`TCategoryId`) ,
|
PRIMARY KEY (`TCategoryId`) ,
|
||||||
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
|
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
INSERT IGNORE INTO `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (`Name`) VALUES ('Hacking'),('Ingame-Bug'),('Website-Bug'),('Installation');
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_user`
|
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_user`
|
||||||
|
@ -65,9 +65,9 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (
|
||||||
`TUserId` INT(10) NOT NULL AUTO_INCREMENT ,
|
`TUserId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Permission` INT(3) NOT NULL DEFAULT 1 ,
|
`Permission` INT(3) NOT NULL DEFAULT 1 ,
|
||||||
`ExternId` INT(10) NOT NULL ,
|
`ExternId` INT(10) UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`TUserId`) )
|
PRIMARY KEY (`TUserId`) )
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` (
|
||||||
`TId` INT NOT NULL AUTO_INCREMENT ,
|
`TId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Timestamp` TIMESTAMP NOT NULL ,
|
`Timestamp` TIMESTAMP NOT NULL ,
|
||||||
`Title` VARCHAR(120) NOT NULL ,
|
`Title` VARCHAR(120) NOT NULL ,
|
||||||
`Status` INT NULL DEFAULT 0 ,
|
`Status` INT NULL DEFAULT 0 ,
|
||||||
`Queue` INT NULL DEFAULT 0 ,
|
`Queue` INT NULL DEFAULT 0 ,
|
||||||
`Priority` INT NULL DEFAULT 0 ,
|
`Ticket_Category` INT UNSIGNED NOT NULL ,
|
||||||
`Ticket_Category` INT NOT NULL ,
|
`Author` INT UNSIGNED NOT NULL ,
|
||||||
`Author` INT NOT NULL ,
|
`Priority` INT(3) NULL DEFAULT 0 ,
|
||||||
PRIMARY KEY (`TId`) ,
|
PRIMARY KEY (`TId`) ,
|
||||||
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
|
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
|
||||||
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
|
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
|
||||||
|
@ -108,8 +108,8 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` (
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`User` INT NOT NULL ,
|
`User` INT UNSIGNED NOT NULL ,
|
||||||
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
|
||||||
PRIMARY KEY (`Ticket`, `User`) ,
|
PRIMARY KEY (`Ticket`, `User`) ,
|
||||||
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
|
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` (
|
||||||
`TagId` INT NOT NULL AUTO_INCREMENT ,
|
`TagId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Value` VARCHAR(60) NOT NULL ,
|
`Value` VARCHAR(60) NOT NULL ,
|
||||||
PRIMARY KEY (`TagId`) ,
|
PRIMARY KEY (`TagId`) ,
|
||||||
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
|
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
|
||||||
|
@ -145,8 +145,8 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` (
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`Tag` INT NOT NULL ,
|
`Tag` INT UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`Ticket`, `Tag`) ,
|
PRIMARY KEY (`Ticket`, `Tag`) ,
|
||||||
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
|
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
|
||||||
CONSTRAINT `fk_tagged_ticket`
|
CONSTRAINT `fk_tagged_ticket`
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` (
|
||||||
`TContentId` INT NOT NULL AUTO_INCREMENT ,
|
`TContentId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Content` TEXT NULL ,
|
`Content` TEXT NULL ,
|
||||||
PRIMARY KEY (`TContentId`) )
|
PRIMARY KEY (`TContentId`) )
|
||||||
ENGINE = InnoDB
|
ENGINE = InnoDB
|
||||||
|
@ -181,10 +181,10 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` (
|
||||||
`TReplyId` INT NOT NULL AUTO_INCREMENT ,
|
`TReplyId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`Author` INT NOT NULL ,
|
`Author` INT UNSIGNED NOT NULL ,
|
||||||
`Content` INT NOT NULL ,
|
`Content` INT UNSIGNED NOT NULL ,
|
||||||
`Timestamp` TIMESTAMP NULL ,
|
`Timestamp` TIMESTAMP NULL ,
|
||||||
PRIMARY KEY (`TReplyId`) ,
|
PRIMARY KEY (`TReplyId`) ,
|
||||||
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
|
||||||
|
@ -214,7 +214,7 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` (
|
||||||
`TGroupId` INT NOT NULL AUTO_INCREMENT ,
|
`TGroupId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Title` VARCHAR(80) NOT NULL ,
|
`Title` VARCHAR(80) NOT NULL ,
|
||||||
PRIMARY KEY (`TGroupId`) ,
|
PRIMARY KEY (`TGroupId`) ,
|
||||||
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
|
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
|
||||||
|
@ -227,8 +227,8 @@
|
||||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` ;
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` (
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` (
|
||||||
`Ticket_Group` INT NOT NULL ,
|
`Ticket_Group` INT UNSIGNED NOT NULL ,
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
|
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
|
||||||
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
|
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
|
||||||
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
|
||||||
|
@ -245,6 +245,34 @@
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_log`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_log` ;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_log` (
|
||||||
|
`TLogId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
|
`Timestamp` TIMESTAMP NOT NULL ,
|
||||||
|
`Query` VARCHAR(255) NOT NULL ,
|
||||||
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
|
`Author` INT(10) UNSIGNED NULL ,
|
||||||
|
PRIMARY KEY (`TLogId`) ,
|
||||||
|
INDEX `fk_ticket_log_ticket1` (`Ticket` ASC) ,
|
||||||
|
INDEX `fk_ticket_log_ticket_user1` (`Author` ASC) ,
|
||||||
|
CONSTRAINT `fk_ticket_log_ticket1`
|
||||||
|
FOREIGN KEY (`Ticket` )
|
||||||
|
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `fk_ticket_log_ticket_user1`
|
||||||
|
FOREIGN KEY (`Author` )
|
||||||
|
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (`TUserId` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (`Name`) VALUES ('Hacking'),('Ingame-Bug'),('Website-Bug'),('Installation');
|
||||||
|
|
||||||
|
|
||||||
";
|
";
|
||||||
$dbl->executeWithoutParams($sql);
|
$dbl->executeWithoutParams($sql);
|
||||||
|
|
|
@ -11,7 +11,7 @@ USE `mydb` ;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket_category` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket_category` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_category` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_category` (
|
||||||
`TCategoryId` INT NOT NULL AUTO_INCREMENT ,
|
`TCategoryId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Name` VARCHAR(45) NOT NULL ,
|
`Name` VARCHAR(45) NOT NULL ,
|
||||||
PRIMARY KEY (`TCategoryId`) ,
|
PRIMARY KEY (`TCategoryId`) ,
|
||||||
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
|
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
|
||||||
|
@ -24,9 +24,9 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket_user` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket_user` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_user` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_user` (
|
||||||
`TUserId` INT(10) NOT NULL AUTO_INCREMENT ,
|
`TUserId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Permission` INT(3) NOT NULL DEFAULT 1 ,
|
`Permission` INT(3) NOT NULL DEFAULT 1 ,
|
||||||
`ExternId` INT(10) NOT NULL ,
|
`ExternId` INT(10) UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`TUserId`) )
|
PRIMARY KEY (`TUserId`) )
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
@ -37,13 +37,14 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket` (
|
||||||
`TId` INT NOT NULL AUTO_INCREMENT ,
|
`TId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Timestamp` TIMESTAMP NOT NULL ,
|
`Timestamp` TIMESTAMP NOT NULL ,
|
||||||
`Title` VARCHAR(120) NOT NULL ,
|
`Title` VARCHAR(120) NOT NULL ,
|
||||||
`Status` INT NULL DEFAULT 0 ,
|
`Status` INT NULL DEFAULT 0 ,
|
||||||
`Queue` INT NULL DEFAULT 0 ,
|
`Queue` INT NULL DEFAULT 0 ,
|
||||||
`Ticket_Category` INT NOT NULL ,
|
`Ticket_Category` INT UNSIGNED NOT NULL ,
|
||||||
`Author` INT NOT NULL ,
|
`Author` INT UNSIGNED NOT NULL ,
|
||||||
|
`Priority` INT(3) NULL DEFAULT 0 ,
|
||||||
PRIMARY KEY (`TId`) ,
|
PRIMARY KEY (`TId`) ,
|
||||||
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
|
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
|
||||||
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
|
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
|
||||||
|
@ -66,8 +67,8 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`assigned` ;
|
DROP TABLE IF EXISTS `mydb`.`assigned` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`assigned` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`assigned` (
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`User` INT NOT NULL ,
|
`User` INT UNSIGNED NOT NULL ,
|
||||||
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
|
||||||
PRIMARY KEY (`Ticket`, `User`) ,
|
PRIMARY KEY (`Ticket`, `User`) ,
|
||||||
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
|
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
|
||||||
|
@ -90,7 +91,7 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`tag` ;
|
DROP TABLE IF EXISTS `mydb`.`tag` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`tag` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`tag` (
|
||||||
`TagId` INT NOT NULL AUTO_INCREMENT ,
|
`TagId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Value` VARCHAR(60) NOT NULL ,
|
`Value` VARCHAR(60) NOT NULL ,
|
||||||
PRIMARY KEY (`TagId`) ,
|
PRIMARY KEY (`TagId`) ,
|
||||||
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
|
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
|
||||||
|
@ -103,8 +104,8 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`tagged` ;
|
DROP TABLE IF EXISTS `mydb`.`tagged` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`tagged` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`tagged` (
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`Tag` INT NOT NULL ,
|
`Tag` INT UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`Ticket`, `Tag`) ,
|
PRIMARY KEY (`Ticket`, `Tag`) ,
|
||||||
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
|
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
|
||||||
CONSTRAINT `fk_tagged_ticket`
|
CONSTRAINT `fk_tagged_ticket`
|
||||||
|
@ -126,7 +127,7 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket_content` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket_content` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_content` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_content` (
|
||||||
`TContentId` INT NOT NULL AUTO_INCREMENT ,
|
`TContentId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Content` TEXT NULL ,
|
`Content` TEXT NULL ,
|
||||||
PRIMARY KEY (`TContentId`) )
|
PRIMARY KEY (`TContentId`) )
|
||||||
ENGINE = InnoDB
|
ENGINE = InnoDB
|
||||||
|
@ -139,10 +140,10 @@ DEFAULT CHARACTER SET = utf8;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket_reply` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket_reply` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_reply` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_reply` (
|
||||||
`TReplyId` INT NOT NULL AUTO_INCREMENT ,
|
`TReplyId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
`Author` INT NOT NULL ,
|
`Author` INT UNSIGNED NOT NULL ,
|
||||||
`Content` INT NOT NULL ,
|
`Content` INT UNSIGNED NOT NULL ,
|
||||||
`Timestamp` TIMESTAMP NULL ,
|
`Timestamp` TIMESTAMP NULL ,
|
||||||
PRIMARY KEY (`TReplyId`) ,
|
PRIMARY KEY (`TReplyId`) ,
|
||||||
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
|
||||||
|
@ -172,7 +173,7 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`ticket_group` ;
|
DROP TABLE IF EXISTS `mydb`.`ticket_group` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_group` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_group` (
|
||||||
`TGroupId` INT NOT NULL AUTO_INCREMENT ,
|
`TGroupId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
`Title` VARCHAR(80) NOT NULL ,
|
`Title` VARCHAR(80) NOT NULL ,
|
||||||
PRIMARY KEY (`TGroupId`) ,
|
PRIMARY KEY (`TGroupId`) ,
|
||||||
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
|
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
|
||||||
|
@ -185,8 +186,8 @@ ENGINE = InnoDB;
|
||||||
DROP TABLE IF EXISTS `mydb`.`in_group` ;
|
DROP TABLE IF EXISTS `mydb`.`in_group` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mydb`.`in_group` (
|
CREATE TABLE IF NOT EXISTS `mydb`.`in_group` (
|
||||||
`Ticket_Group` INT NOT NULL ,
|
`Ticket_Group` INT UNSIGNED NOT NULL ,
|
||||||
`Ticket` INT NOT NULL ,
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
|
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
|
||||||
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
|
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
|
||||||
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
|
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
|
||||||
|
@ -203,6 +204,33 @@ CREATE TABLE IF NOT EXISTS `mydb`.`in_group` (
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `mydb`.`ticket_log`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
DROP TABLE IF EXISTS `mydb`.`ticket_log` ;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_log` (
|
||||||
|
`TLogId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||||
|
`Timestamp` TIMESTAMP NOT NULL ,
|
||||||
|
`Query` VARCHAR(255) NOT NULL ,
|
||||||
|
`Ticket` INT UNSIGNED NOT NULL ,
|
||||||
|
`Author` INT(10) UNSIGNED NULL ,
|
||||||
|
PRIMARY KEY (`TLogId`) ,
|
||||||
|
INDEX `fk_ticket_log_ticket1` (`Ticket` ASC) ,
|
||||||
|
INDEX `fk_ticket_log_ticket_user1` (`Author` ASC) ,
|
||||||
|
CONSTRAINT `fk_ticket_log_ticket1`
|
||||||
|
FOREIGN KEY (`Ticket` )
|
||||||
|
REFERENCES `mydb`.`ticket` (`TId` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `fk_ticket_log_ticket_user1`
|
||||||
|
FOREIGN KEY (`Author` )
|
||||||
|
REFERENCES `mydb`.`ticket_user` (`TUserId` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SET SQL_MODE=@OLD_SQL_MODE;
|
SET SQL_MODE=@OLD_SQL_MODE;
|
||||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue