diff --git a/server/data/db_schema.sql b/server/data/db_schema.sql index c1a79ce6..cae4b7a8 100644 --- a/server/data/db_schema.sql +++ b/server/data/db_schema.sql @@ -1,6 +1,8 @@ --- MySQL dump 10.13 Distrib 5.6.46, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.37, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: development -- ------------------------------------------------------ --- Server version 5.6.46 +-- Server version 5.6.51 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -17,13 +19,18 @@ -- Table structure for table `apikey` -- +DROP TABLE IF EXISTS `apikey`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `apikey` ( +CREATE TABLE `apikey` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `can_create_users` tinyint(1) unsigned DEFAULT NULL, + `can_create_tickets` tinyint(1) unsigned DEFAULT NULL, + `can_check_tickets` tinyint(1) unsigned DEFAULT NULL, + `should_return_ticket_number` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32,9 +39,10 @@ CREATE TABLE IF NOT EXISTS `apikey` ( -- Table structure for table `article` -- +DROP TABLE IF EXISTS `article`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `article` ( +CREATE TABLE `article` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `content` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -51,9 +59,10 @@ CREATE TABLE IF NOT EXISTS `article` ( -- Table structure for table `ban` -- +DROP TABLE IF EXISTS `ban`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `ban` ( +CREATE TABLE `ban` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) @@ -64,9 +73,10 @@ CREATE TABLE IF NOT EXISTS `ban` ( -- Table structure for table `customfield` -- +DROP TABLE IF EXISTS `customfield`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `customfield` ( +CREATE TABLE `customfield` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -79,9 +89,10 @@ CREATE TABLE IF NOT EXISTS `customfield` ( -- Table structure for table `customfieldoption` -- +DROP TABLE IF EXISTS `customfieldoption`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `customfieldoption` ( +CREATE TABLE `customfieldoption` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `customfield_id` int(11) unsigned DEFAULT NULL, @@ -95,9 +106,10 @@ CREATE TABLE IF NOT EXISTS `customfieldoption` ( -- Table structure for table `customfieldvalue` -- +DROP TABLE IF EXISTS `customfieldvalue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `customfieldvalue` ( +CREATE TABLE `customfieldvalue` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `value` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `user_id` int(11) unsigned DEFAULT NULL, @@ -117,9 +129,10 @@ CREATE TABLE IF NOT EXISTS `customfieldvalue` ( -- Table structure for table `customresponse` -- +DROP TABLE IF EXISTS `customresponse`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `customresponse` ( +CREATE TABLE `customresponse` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `language` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -132,9 +145,10 @@ CREATE TABLE IF NOT EXISTS `customresponse` ( -- Table structure for table `department` -- +DROP TABLE IF EXISTS `department`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `department` ( +CREATE TABLE `department` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `owners` int(11) unsigned DEFAULT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -147,9 +161,10 @@ CREATE TABLE IF NOT EXISTS `department` ( -- Table structure for table `department_staff` -- +DROP TABLE IF EXISTS `department_staff`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `department_staff` ( +CREATE TABLE `department_staff` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `department_id` int(11) unsigned DEFAULT NULL, `staff_id` int(11) unsigned DEFAULT NULL, @@ -166,9 +181,10 @@ CREATE TABLE IF NOT EXISTS `department_staff` ( -- Table structure for table `language` -- +DROP TABLE IF EXISTS `language`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `language` ( +CREATE TABLE `language` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `allowed` int(11) unsigned DEFAULT NULL, @@ -181,9 +197,10 @@ CREATE TABLE IF NOT EXISTS `language` ( -- Table structure for table `log` -- +DROP TABLE IF EXISTS `log`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `log` ( +CREATE TABLE `log` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `to` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -204,9 +221,10 @@ CREATE TABLE IF NOT EXISTS `log` ( -- Table structure for table `mailtemplate` -- +DROP TABLE IF EXISTS `mailtemplate`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `mailtemplate` ( +CREATE TABLE `mailtemplate` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `template` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `subject` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -222,9 +240,10 @@ CREATE TABLE IF NOT EXISTS `mailtemplate` ( -- Table structure for table `recoverpassword` -- +DROP TABLE IF EXISTS `recoverpassword`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `recoverpassword` ( +CREATE TABLE `recoverpassword` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -237,17 +256,24 @@ CREATE TABLE IF NOT EXISTS `recoverpassword` ( -- Table structure for table `sessioncookie` -- +DROP TABLE IF EXISTS `sessioncookie`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `sessioncookie` ( +CREATE TABLE `sessioncookie` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ip` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `creation_date` double DEFAULT NULL, `expiration_date` double DEFAULT NULL, `user_id` int(11) unsigned DEFAULT NULL, + `is_staff` tinyint(1) unsigned DEFAULT NULL, + `staff` tinyint(1) unsigned DEFAULT NULL, + `user` tinyint(1) unsigned DEFAULT NULL, + `staff_id` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `index_foreignkey_sessioncookie_user` (`user_id`), + KEY `index_foreignkey_sessioncookie_staff` (`staff_id`), + CONSTRAINT `c_fk_sessioncookie_staff_id` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `c_fk_sessioncookie_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -256,9 +282,10 @@ CREATE TABLE IF NOT EXISTS `sessioncookie` ( -- Table structure for table `setting` -- +DROP TABLE IF EXISTS `setting`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `setting` ( +CREATE TABLE `setting` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `value` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -270,9 +297,10 @@ CREATE TABLE IF NOT EXISTS `setting` ( -- Table structure for table `staff` -- +DROP TABLE IF EXISTS `staff`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `staff` ( +CREATE TABLE `staff` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `level` int(11) unsigned DEFAULT NULL, `send_email_on_new_ticket` int(11) unsigned DEFAULT NULL, @@ -291,9 +319,10 @@ CREATE TABLE IF NOT EXISTS `staff` ( -- Table structure for table `staff_ticket` -- +DROP TABLE IF EXISTS `staff_ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `staff_ticket` ( +CREATE TABLE `staff_ticket` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` int(11) unsigned DEFAULT NULL, `staff_id` int(11) unsigned DEFAULT NULL, @@ -306,13 +335,47 @@ CREATE TABLE IF NOT EXISTS `staff_ticket` ( ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `supervisedrelation` +-- + +DROP TABLE IF EXISTS `supervisedrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supervisedrelation` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supervisedrelation_user` +-- + +DROP TABLE IF EXISTS `supervisedrelation_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supervisedrelation_user` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(11) unsigned DEFAULT NULL, + `supervisedrelation_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UQ_0c5228cfadd3dca1357880bf711030ed41da30f9` (`supervisedrelation_id`,`user_id`), + KEY `index_foreignkey_supervisedrelation_user_user` (`user_id`), + KEY `index_foreignkey_supervisedrelation_user_supervisedrelation` (`supervisedrelation_id`), + CONSTRAINT `c_fk_supervisedrelation_user_supervisedrelation_id` FOREIGN KEY (`supervisedrelation_id`) REFERENCES `supervisedrelation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_fk_supervisedrelation_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `tag` -- +DROP TABLE IF EXISTS `tag`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `tag` ( +CREATE TABLE `tag` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `color` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -324,9 +387,10 @@ CREATE TABLE IF NOT EXISTS `tag` ( -- Table structure for table `tag_ticket` -- +DROP TABLE IF EXISTS `tag_ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `tag_ticket` ( +CREATE TABLE `tag_ticket` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `tag_id` int(11) unsigned DEFAULT NULL, `ticket_id` int(11) unsigned DEFAULT NULL, @@ -343,9 +407,10 @@ CREATE TABLE IF NOT EXISTS `tag_ticket` ( -- Table structure for table `ticket` -- +DROP TABLE IF EXISTS `ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `ticket` ( +CREATE TABLE `ticket` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_number` int(11) unsigned DEFAULT NULL, `unread` tinyint(1) unsigned DEFAULT NULL, @@ -367,6 +432,11 @@ CREATE TABLE IF NOT EXISTS `ticket` ( `owner` tinyint(1) unsigned DEFAULT NULL, `edited_content` tinyint(1) unsigned DEFAULT NULL, `edited_title` tinyint(1) unsigned DEFAULT NULL, + `total_departments` int(11) unsigned DEFAULT NULL, + `total_owners` int(11) unsigned DEFAULT NULL, + `first_closed_at` double DEFAULT NULL, + `last_closed_at` double DEFAULT NULL, + `reopened` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `index_foreignkey_ticket_department` (`department_id`), KEY `index_foreignkey_ticket_author` (`author_id`), @@ -383,9 +453,10 @@ CREATE TABLE IF NOT EXISTS `ticket` ( -- Table structure for table `ticket_user` -- +DROP TABLE IF EXISTS `ticket_user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `ticket_user` ( +CREATE TABLE `ticket_user` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` int(11) unsigned DEFAULT NULL, `user_id` int(11) unsigned DEFAULT NULL, @@ -402,16 +473,17 @@ CREATE TABLE IF NOT EXISTS `ticket_user` ( -- Table structure for table `ticketevent` -- +DROP TABLE IF EXISTS `ticketevent`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `ticketevent` ( +CREATE TABLE `ticketevent` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `content` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `date` double DEFAULT NULL, `ticket_id` int(11) unsigned DEFAULT NULL, `author_staff_id` int(11) unsigned DEFAULT NULL, - `file` tinyint(1) unsigned DEFAULT NULL, + `file` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `private` int(11) unsigned DEFAULT NULL, `author_user_id` int(11) unsigned DEFAULT NULL, `edited_content` tinyint(1) unsigned DEFAULT NULL, @@ -429,9 +501,10 @@ CREATE TABLE IF NOT EXISTS `ticketevent` ( -- Table structure for table `topic` -- +DROP TABLE IF EXISTS `topic`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `topic` ( +CREATE TABLE `topic` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `icon` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -445,9 +518,10 @@ CREATE TABLE IF NOT EXISTS `topic` ( -- Table structure for table `user` -- +DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE IF NOT EXISTS `user` ( +CREATE TABLE `user` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -456,7 +530,11 @@ CREATE TABLE IF NOT EXISTS `user` ( `tickets` int(11) unsigned DEFAULT NULL, `verification_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `disabled` int(11) unsigned DEFAULT NULL, - PRIMARY KEY (`id`) + `not_registered` tinyint(1) unsigned DEFAULT NULL, + `supervisedrelation_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `index_foreignkey_user_supervisedrelation` (`supervisedrelation_id`), + CONSTRAINT `c_fk_user_supervisedrelation_id` FOREIGN KEY (`supervisedrelation_id`) REFERENCES `supervisedrelation` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -469,4 +547,4 @@ CREATE TABLE IF NOT EXISTS `user` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-18 20:58:21 +-- Dump completed on 2022-03-23 12:28:30