You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
help_server/sql/db.sql

175 lines
8.1 KiB

-- MySQL dump 10.13 Distrib 8.0.20, for Linux (x86_64)
--
-- Host: localhost Database: help
-- ------------------------------------------------------
-- Server version 8.0.20
/*!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 `activity`
--
DROP TABLE IF EXISTS `activity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `activity` (
`activity_id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动id',
`title` varchar(30) NOT NULL COMMENT '活动标题',
`content` varchar(50) NOT NULL COMMENT '活动内容',
`seek_help_time` datetime NOT NULL COMMENT '求助时间',
`activity_start_time` datetime NOT NULL COMMENT '活动开始时间',
`activity_end_time` datetime NOT NULL COMMENT '活动结束时间',
`activity_img` varchar(41) NOT NULL COMMENT '活动背景图',
`service_address` varchar(10) NOT NULL COMMENT '服务地点',
`user_id` varchar(20) NOT NULL COMMENT '求助用户',
PRIMARY KEY (`activity_id`),
KEY `activity_user_user_id_fk` (`user_id`),
CONSTRAINT `activity_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `activity_history`
--
DROP TABLE IF EXISTS `activity_history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `activity_history` (
`history_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录id',
`activity_id` bigint NOT NULL COMMENT '活动id',
`user_id` varchar(20) DEFAULT NULL COMMENT '志愿者id',
`activity_status` varchar(10) NOT NULL COMMENT '记录状态',
`create_time` datetime NOT NULL COMMENT '创建时间',
`activity_score` bigint DEFAULT NULL COMMENT '活动评分',
`time_score` int DEFAULT NULL COMMENT '奖励时间币',
PRIMARY KEY (`history_id`),
KEY `activity_history_activity_activity_id_fk` (`activity_id`),
KEY `activity_history_user_user_id_fk` (`user_id`),
CONSTRAINT `activity_history_activity_activity_id_fk` FOREIGN KEY (`activity_id`) REFERENCES `activity` (`activity_id`),
CONSTRAINT `activity_history_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='志愿者活动记录表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `chat_history`
--
DROP TABLE IF EXISTS `chat_history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_history` (
`chat_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录id',
`source_user_id` varchar(20) NOT NULL COMMENT '发送用户',
`target_user_id` varchar(20) NOT NULL COMMENT '接受用户',
`send_time` datetime NOT NULL COMMENT '发送时间',
`content` varchar(150) NOT NULL COMMENT '发送内容',
PRIMARY KEY (`chat_id`),
KEY `chat_history_user_user_id_fk` (`source_user_id`),
KEY `chat_history_user_user_id_fk_2` (`target_user_id`),
CONSTRAINT `chat_history_user_user_id_fk` FOREIGN KEY (`source_user_id`) REFERENCES `user` (`user_id`),
CONSTRAINT `chat_history_user_user_id_fk_2` FOREIGN KEY (`target_user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='聊天记录表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `friend`
--
DROP TABLE IF EXISTS `friend`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `friend` (
`source_user_id` varchar(20) NOT NULL COMMENT '发起好友邀请用户',
`target_user_id` varchar(20) NOT NULL COMMENT '接受好友邀请用户',
PRIMARY KEY (`source_user_id`,`target_user_id`),
KEY `friend_user_user_id_fk_2` (`target_user_id`),
CONSTRAINT `friend_user_user_id_fk` FOREIGN KEY (`source_user_id`) REFERENCES `user` (`user_id`),
CONSTRAINT `friend_user_user_id_fk_2` FOREIGN KEY (`target_user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='好友表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `leave_word`
--
DROP TABLE IF EXISTS `leave_word`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `leave_word` (
`leave_word_id` bigint NOT NULL AUTO_INCREMENT COMMENT '留言id',
`type` varchar(10) NOT NULL COMMENT '留言类型',
`source_user_id` varchar(20) NOT NULL COMMENT '留言用户id',
`target_user_id` varchar(20) NOT NULL COMMENT '留言接受用户id',
`activity_id` bigint DEFAULT NULL COMMENT '活动id',
`create_time` datetime NOT NULL,
PRIMARY KEY (`leave_word_id`),
KEY `leave_word_activity_activity_id_fk` (`activity_id`),
KEY `leave_word_user_user_id_fk` (`source_user_id`),
KEY `leave_word_user_user_id_fk_2` (`target_user_id`),
CONSTRAINT `leave_word_activity_activity_id_fk` FOREIGN KEY (`activity_id`) REFERENCES `activity` (`activity_id`),
CONSTRAINT `leave_word_user_user_id_fk` FOREIGN KEY (`source_user_id`) REFERENCES `user` (`user_id`),
CONSTRAINT `leave_word_user_user_id_fk_2` FOREIGN KEY (`target_user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='留言表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `manager`
--
DROP TABLE IF EXISTS `manager`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `manager` (
`manager_id` varchar(20) NOT NULL COMMENT '管理员账号',
`password` varchar(32) NOT NULL COMMENT '密码',
PRIMARY KEY (`manager_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='管理员表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`user_id` varchar(20) NOT NULL COMMENT '用户账号',
`password` varchar(32) NOT NULL COMMENT '用户密码',
`name` varchar(10) NOT NULL COMMENT '姓名',
`sex` varchar(5) NOT NULL COMMENT '性别',
`head_img` varchar(41) NOT NULL COMMENT '头像',
`address` varchar(10) NOT NULL COMMENT '住址',
`service_address` varchar(10) NOT NULL COMMENT '服务地点',
`user_type` varchar(10) NOT NULL COMMENT '用户身份',
`mobile` bigint NOT NULL COMMENT '手机号',
`email` varchar(20) NOT NULL COMMENT '邮箱',
`info` varchar(50) NOT NULL COMMENT '简介',
`time_score` int NOT NULL COMMENT '时间币',
`chat_status` tinyint(1) NOT NULL COMMENT '聊天室状态',
`age` int NOT NULL COMMENT '年龄',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';
/*!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-05-30 21:23:52