数据库建表sql

master
pan 5 years ago
parent 1fa22d5d0a
commit 7c75d3792b
  1. 243
      sql/db.sql

@ -0,0 +1,243 @@
-- 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 */;
--
-- Dumping data for table `activity`
--
LOCK TABLES `activity` WRITE;
/*!40000 ALTER TABLE `activity` DISABLE KEYS */;
INSERT INTO `activity` VALUES (63,'123','123','2020-05-30 01:46:12','2020-05-28 01:46:04','2020-06-07 01:46:04','37b6f53b-1c1d-494f-b25a-10dd7d3e77e4.jpeg','北京','222'),(64,'123','123','2020-05-30 03:07:29','2020-05-30 03:07:23','2020-06-07 03:07:23','aedeb2b0-21ed-4ad2-b3b0-bcfd8ce0c6c5.jpeg','广州','222'),(65,'123','123','2020-05-30 04:21:08','2020-05-31 04:19:00','2020-06-07 04:19:00','dd3dcdc2-d432-4391-9181-fe70ea678523.jpeg','北京','123'),(66,'123','123','2020-05-30 05:14:36','2020-05-31 05:14:04','2020-06-07 05:14:04','b1f5f2b2-559f-4d1e-be9e-4f5a439dfca5.jpeg','广州','123'),(67,'阿斯顿发生地方','啊手动阀手动阀','2020-05-30 05:34:34','2020-05-28 05:34:09','2020-06-07 05:34:09','adfc831e-e885-433a-a056-1443016f1a25.jpeg','北京','123'),(68,'123','123','2020-05-30 05:36:32','2020-05-28 01:46:04','2020-06-07 01:46:04','37b6f53b-1c1d-494f-b25a-10dd7d3e77e4.jpeg','北京','222'),(69,'123','123','2020-05-30 05:38:37','2020-05-28 01:46:04','2020-06-07 01:46:04','37b6f53b-1c1d-494f-b25a-10dd7d3e77e4.jpeg','北京','222'),(70,'123','123','2020-05-30 05:39:53','2020-05-28 01:46:04','2020-06-07 01:46:04','37b6f53b-1c1d-494f-b25a-10dd7d3e77e4.jpeg','北京','222'),(71,'123','123','2020-05-30 05:41:11','2020-05-28 01:46:04','2020-06-07 01:46:04','37b6f53b-1c1d-494f-b25a-10dd7d3e77e4.jpeg','北京','222'),(72,'按时发撒地方','阿斯蒂芬撒地方','2020-05-30 05:42:01','2020-05-31 05:41:44','2020-06-07 05:41:44','308a9e0b-9dcb-48af-8bc7-9887e2e7560b.jpeg','北京','123'),(73,'123阿斯蒂芬','阿斯蒂芬','2020-05-30 05:49:12','2020-05-31 05:48:48','2020-06-07 05:48:48','334571d0-7d82-4f1a-a150-8292f7955983.jpeg','广州','123'),(74,'123sdfasd123','123123','2020-05-30 05:54:25','2020-05-31 05:54:14','2020-06-07 05:54:14','743ed369-8e92-4cfb-b871-61491ec1df19.jpeg','广州','123'),(75,'zda123','123','2020-05-30 05:54:44','2020-05-31 05:54:28','2020-06-07 05:54:28','10e4bd17-e3d9-44eb-9dc2-c39fc2360515.jpeg','广州','123'),(76,'超级赛亚人','123123','2020-05-30 05:55:07','2020-05-31 05:54:46','2020-06-07 05:54:46','9f03124e-59bb-4523-a274-1a4d757dbcc6.jpeg','上海','123'),(77,'fasdf123','12321','2020-05-30 06:56:11','2020-05-31 06:56:02','2020-06-07 06:56:02','2d28958f-66b9-4da8-895e-34b695d55d5d.jpeg','北京','222');
/*!40000 ALTER TABLE `activity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `activity_history`
--
LOCK TABLES `activity_history` WRITE;
/*!40000 ALTER TABLE `activity_history` DISABLE KEYS */;
INSERT INTO `activity_history` VALUES (64,63,'123','apply','2020-05-30 01:46:22',NULL,NULL),(65,63,'123','join','2020-05-29 01:47:31',NULL,NULL),(66,63,'123','complete','2020-05-30 01:50:04',5,24),(67,64,'123','apply','2020-05-30 03:07:39',NULL,NULL),(68,64,'123','join','2020-05-29 03:08:22',NULL,NULL),(76,64,'123','complete','2020-05-30 03:39:10',NULL,24),(77,73,'222','apply','2020-05-30 05:52:08',NULL,NULL),(78,76,'222','apply','2020-05-30 05:55:26',NULL,NULL),(79,76,'777','apply','2020-05-30 05:55:50',NULL,NULL),(80,75,'777','apply','2020-05-30 06:54:36',NULL,NULL),(81,75,'222','apply','2020-05-30 06:58:31',NULL,NULL),(82,74,'222','apply','2020-05-30 06:58:43',NULL,NULL),(83,72,'222','apply','2020-05-30 07:00:58',NULL,NULL),(84,67,'222','apply','2020-05-30 07:17:39',NULL,NULL),(90,67,'222','join','2020-05-30 07:37:30',NULL,NULL),(93,67,'222','complete','2020-05-30 07:50:58',5,0);
/*!40000 ALTER TABLE `activity_history` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `chat_history`
--
LOCK TABLES `chat_history` WRITE;
/*!40000 ALTER TABLE `chat_history` DISABLE KEYS */;
/*!40000 ALTER TABLE `chat_history` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `friend`
--
LOCK TABLES `friend` WRITE;
/*!40000 ALTER TABLE `friend` DISABLE KEYS */;
INSERT INTO `friend` VALUES ('222','123'),('123','777'),('888','777');
/*!40000 ALTER TABLE `friend` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `leave_word`
--
LOCK TABLES `leave_word` WRITE;
/*!40000 ALTER TABLE `leave_word` DISABLE KEYS */;
INSERT INTO `leave_word` VALUES (58,'apply','123','222',63,'2020-05-30 01:46:22'),(59,'join','123','222',63,'2020-05-30 01:47:31'),(60,'complete','123','222',63,'2020-05-30 01:50:04'),(61,'apply','123','222',64,'2020-05-30 03:07:39'),(62,'join','123','222',64,'2020-05-30 03:08:22'),(63,'complete','123','222',64,'2020-05-30 03:08:46'),(64,'complete','123','222',64,'2020-05-30 03:09:31'),(65,'complete','123','222',64,'2020-05-30 03:10:54'),(66,'complete','123','222',64,'2020-05-30 03:16:53'),(67,'complete','123','222',64,'2020-05-30 03:17:48'),(68,'complete','123','222',64,'2020-05-30 03:18:54'),(69,'complete','123','222',64,'2020-05-30 03:33:03'),(70,'complete','123','222',64,'2020-05-30 03:39:10'),(73,'recommend','123','222',73,'2020-05-30 05:49:12'),(74,'apply','222','123',73,'2020-05-30 05:52:08'),(75,'recommend','123','222',76,'2020-05-30 05:55:07'),(76,'recommend','123','777',76,'2020-05-30 05:55:07'),(77,'apply','222','123',76,'2020-05-30 05:55:26'),(78,'apply','777','123',76,'2020-05-30 05:55:50'),(79,'friend','777','222',NULL,'2020-05-30 06:05:33'),(80,'apply','777','123',75,'2020-05-30 06:54:36'),(81,'apply','222','123',75,'2020-05-30 06:58:31'),(82,'apply','222','123',74,'2020-05-30 06:58:43'),(83,'apply','222','123',72,'2020-05-30 07:00:58'),(84,'apply','222','123',67,'2020-05-30 07:17:39'),(85,'join','222','123',67,'2020-05-30 07:30:42'),(86,'complete','222','123',67,'2020-05-30 07:30:46'),(87,'complete','222','123',67,'2020-05-30 07:32:27'),(88,'complete','222','123',67,'2020-05-30 07:33:40'),(89,'join','222','123',67,'2020-05-30 07:34:10'),(90,'join','222','123',67,'2020-05-30 07:37:30'),(91,'complete','222','123',67,'2020-05-30 07:37:42'),(92,'complete','222','123',67,'2020-05-30 07:41:49'),(93,'complete','222','123',67,'2020-05-30 07:50:58');
/*!40000 ALTER TABLE `leave_word` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `manager`
--
LOCK TABLES `manager` WRITE;
/*!40000 ALTER TABLE `manager` DISABLE KEYS */;
/*!40000 ALTER TABLE `manager` ENABLE KEYS */;
UNLOCK TABLES;
--
-- 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 */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES ('123','202cb962ac59075b964b07152d234b70','123','women','1e3d9593-a6a2-4c06-a529-01e95416a4de.jpeg','123','广州','seekHelp',15920722180,'1029559041@qq.com','123',240,0,18),('222','202cb962ac59075b964b07152d234b70','123','man','2c78fbb8-7b05-4581-aee9-0869e98fe00c.jpeg','123','广州','seekHelp',15920722180,'1029559041@qq.com','123',20,0,18),('777','250cf8b51c773f3f8dc8b4be867a9a02','666','man','8940ef37-883e-4648-8ac8-4738a2df363e.jpeg','123','上海','help',15920722180,'1029559041@qq.com','123',20,0,24),('888','202cb962ac59075b964b07152d234b70','123','women','a7efcf58-1017-4201-83f4-f022333b601e.jpeg','123','北京','seekHelp',15920722180,'1029559041@qq.com','123',20,0,18);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!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:04:04
Loading…
Cancel
Save