text: -- MySQL dump 10.13  Distrib 8.0.17, for Win64 (x86_64)
  --
  -- Host: localhost    Database: task_force
  -- ------------------------------------------------------
  -- Server version	8.0.17
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!50503 SET NAMES utf8mb4 */;
  /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  /*!40103 SET TIME_ZONE='+00:00' */;
  /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  
  --
  -- Table structure for table `categories`
  --
  
  DROP TABLE IF EXISTS `categories`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `categories` (
    `category_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) NOT NULL,
    `label` varchar(64) NOT NULL,
    PRIMARY KEY (`category_id`),
    UNIQUE KEY `title` (`title`),
    UNIQUE KEY `label` (`label`)
  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `feedbacks`
  --
  
  DROP TABLE IF EXISTS `feedbacks`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `feedbacks` (
    `feedback_id` int(11) NOT NULL AUTO_INCREMENT,
    `author_id` int(11) NOT NULL,
    `recipient_id` int(11) NOT NULL,
    `task_id` int(11) NOT NULL,
    `desc_text` text,
    `point_num` int(11) NOT NULL,
    `add_time` datetime NOT NULL,
    PRIMARY KEY (`feedback_id`),
    KEY `author_id` (`author_id`),
    KEY `recipient_id` (`recipient_id`),
    KEY `task_id` (`task_id`),
    CONSTRAINT `feedbacks_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `feedbacks_ibfk_2` FOREIGN KEY (`recipient_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `feedbacks_ibfk_3` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `locations`
  --
  
  DROP TABLE IF EXISTS `locations`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `locations` (
    `location_id` int(11) NOT NULL AUTO_INCREMENT,
    `city` varchar(64) NOT NULL,
    `latitude` varchar(255) NOT NULL,
    `longitude` varchar(255) NOT NULL,
    PRIMARY KEY (`location_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=1109 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `messages`
  --
  
  DROP TABLE IF EXISTS `messages`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `messages` (
    `message_id` int(11) NOT NULL AUTO_INCREMENT,
    `task_id` int(11) NOT NULL,
    `sender_id` int(11) NOT NULL,
    `receiver_id` int(11) NOT NULL,
    `mess_text` text NOT NULL,
    `add_time` datetime NOT NULL,
    PRIMARY KEY (`message_id`),
    KEY `task_id` (`task_id`),
    KEY `sender_id` (`sender_id`),
    KEY `receiver_id` (`receiver_id`),
    CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`),
    CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `messages_ibfk_3` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `offers`
  --
  
  DROP TABLE IF EXISTS `offers`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `offers` (
    `offer_id` int(11) NOT NULL AUTO_INCREMENT,
    `task_id` int(11) NOT NULL,
    `contractor_id` int(11) NOT NULL,
    `price` int(10) unsigned DEFAULT NULL,
    `desc_text` text NOT NULL,
    `add_time` datetime NOT NULL,
    PRIMARY KEY (`offer_id`),
    KEY `task_id` (`task_id`),
    KEY `contractor_id` (`contractor_id`),
    CONSTRAINT `offers_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`),
    CONSTRAINT `offers_ibfk_2` FOREIGN KEY (`contractor_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `task_actions`
  --
  
  DROP TABLE IF EXISTS `task_actions`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `task_actions` (
    `action_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) NOT NULL,
    `const_name` varchar(64) NOT NULL,
    PRIMARY KEY (`action_id`),
    UNIQUE KEY `title` (`title`),
    UNIQUE KEY `const_name` (`const_name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `task_failings`
  --
  
  DROP TABLE IF EXISTS `task_failings`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `task_failings` (
    `failing_id` int(11) NOT NULL AUTO_INCREMENT,
    `task_id` int(11) NOT NULL,
    `contractor_id` int(11) NOT NULL,
    PRIMARY KEY (`failing_id`),
    KEY `task_id` (`task_id`),
    KEY `contractor_id` (`contractor_id`),
    CONSTRAINT `task_failings_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`),
    CONSTRAINT `task_failings_ibfk_2` FOREIGN KEY (`contractor_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `task_files`
  --
  
  DROP TABLE IF EXISTS `task_files`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `task_files` (
    `file_id` int(11) NOT NULL AUTO_INCREMENT,
    `task_id` int(11) NOT NULL,
    `file_addr` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`file_id`),
    KEY `task_id` (`task_id`),
    CONSTRAINT `task_files_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `task_runnings`
  --
  
  DROP TABLE IF EXISTS `task_runnings`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `task_runnings` (
    `running_id` int(11) NOT NULL AUTO_INCREMENT,
    `task_id` int(11) NOT NULL,
    `contractor_id` int(11) NOT NULL,
    PRIMARY KEY (`running_id`),
    KEY `task_id` (`task_id`),
    KEY `contractor_id` (`contractor_id`),
    CONSTRAINT `task_runnings_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`task_id`),
    CONSTRAINT `task_runnings_ibfk_2` FOREIGN KEY (`contractor_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `task_statuses`
  --
  
  DROP TABLE IF EXISTS `task_statuses`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `task_statuses` (
    `status_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) NOT NULL,
    `const_name` varchar(64) NOT NULL,
    PRIMARY KEY (`status_id`),
    UNIQUE KEY `title` (`title`),
    UNIQUE KEY `const_name` (`const_name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `tasks`
  --
  
  DROP TABLE IF EXISTS `tasks`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `tasks` (
    `task_id` int(11) NOT NULL AUTO_INCREMENT,
    `status_id` int(11) NOT NULL,
    `category_id` int(11) NOT NULL,
    `location_id` int(11) NOT NULL,
    `customer_id` int(11) NOT NULL,
    `title` varchar(128) NOT NULL,
    `desc_text` text NOT NULL,
    `price` int(10) unsigned DEFAULT NULL,
    `full_address` varchar(255) DEFAULT NULL,
    `address_desc` varchar(255) DEFAULT NULL,
    `latitude` varchar(255) DEFAULT NULL,
    `longitude` varchar(255) DEFAULT NULL,
    `add_time` datetime NOT NULL,
    `end_date` datetime DEFAULT NULL,
    `is_remote` tinyint(1) DEFAULT '1',
    PRIMARY KEY (`task_id`),
    KEY `status_id` (`status_id`),
    KEY `category_id` (`category_id`),
    KEY `location_id` (`location_id`),
    KEY `customer_id` (`customer_id`),
    FULLTEXT KEY `tasks_full_name_fulltext` (`title`),
    CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`status_id`) REFERENCES `task_statuses` (`status_id`),
    CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`),
    CONSTRAINT `tasks_ibfk_3` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`),
    CONSTRAINT `tasks_ibfk_4` FOREIGN KEY (`customer_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_favorites`
  --
  
  DROP TABLE IF EXISTS `user_favorites`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_favorites` (
    `favorite_id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `fave_user_id` int(11) NOT NULL,
    `is_fave` tinyint(1) DEFAULT '1',
    PRIMARY KEY (`favorite_id`),
    KEY `user_id` (`user_id`),
    KEY `fave_user_id` (`fave_user_id`),
    CONSTRAINT `user_favorites_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `user_favorites_ibfk_2` FOREIGN KEY (`fave_user_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_notification_settings`
  --
  
  DROP TABLE IF EXISTS `user_notification_settings`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_notification_settings` (
    `setting_id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `notification_id` int(11) NOT NULL,
    `is_active` tinyint(1) DEFAULT '1',
    PRIMARY KEY (`setting_id`),
    KEY `user_id` (`user_id`),
    KEY `notification_id` (`notification_id`),
    CONSTRAINT `user_notification_settings_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `user_notification_settings_ibfk_2` FOREIGN KEY (`notification_id`) REFERENCES `user_notifications` (`notification_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_notifications`
  --
  
  DROP TABLE IF EXISTS `user_notifications`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_notifications` (
    `notification_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) NOT NULL,
    `label` varchar(64) NOT NULL,
    PRIMARY KEY (`notification_id`),
    UNIQUE KEY `title` (`title`),
    UNIQUE KEY `label` (`label`)
  ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_portfolio_images`
  --
  
  DROP TABLE IF EXISTS `user_portfolio_images`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_portfolio_images` (
    `image_id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `image_addr` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`image_id`),
    KEY `user_id` (`user_id`),
    CONSTRAINT `user_portfolio_images_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_roles`
  --
  
  DROP TABLE IF EXISTS `user_roles`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_roles` (
    `role_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) NOT NULL,
    `const_name` varchar(64) NOT NULL,
    PRIMARY KEY (`role_id`),
    UNIQUE KEY `title` (`title`),
    UNIQUE KEY `const_name` (`const_name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `user_specializations`
  --
  
  DROP TABLE IF EXISTS `user_specializations`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `user_specializations` (
    `specialization_id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `category_id` int(11) DEFAULT NULL,
    PRIMARY KEY (`specialization_id`),
    KEY `user_id` (`user_id`),
    KEY `category_id` (`category_id`),
    CONSTRAINT `user_specializations_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
    CONSTRAINT `user_specializations_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `users`
  --
  
  DROP TABLE IF EXISTS `users`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!50503 SET character_set_client = utf8mb4 */;
  CREATE TABLE `users` (
    `user_id` int(11) NOT NULL AUTO_INCREMENT,
    `role_id` int(11) NOT NULL DEFAULT '1',
    `location_id` int(11) NOT NULL,
    `full_name` varchar(64) NOT NULL,
    `email` varchar(64) NOT NULL,
    `phone` varchar(11) DEFAULT NULL,
    `skype` varchar(64) DEFAULT NULL,
    `messaging_contact` varchar(64) DEFAULT NULL,
    `full_address` varchar(255) DEFAULT NULL,
    `avatar_addr` varchar(255) DEFAULT NULL,
    `desc_text` text,
    `password_key` varchar(255) NOT NULL,
    `birth_date` date DEFAULT NULL,
    `reg_time` datetime NOT NULL,
    `activity_time` datetime NOT NULL,
    `hide_contacts` tinyint(1) NOT NULL DEFAULT '0',
    `hide_profile` tinyint(1) NOT NULL DEFAULT '0',
    PRIMARY KEY (`user_id`),
    UNIQUE KEY `email` (`email`),
    KEY `role_id` (`role_id`),
    KEY `location_id` (`location_id`),
    FULLTEXT KEY `users_full_name_fulltext` (`full_name`),
    CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `user_roles` (`role_id`),
    CONSTRAINT `users_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  
  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  
  -- Dump completed on 2020-12-29 18:46:45
  