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.
TimeManager/src/timemanagerapp/createdb.sql

135 lines
4.3 KiB

/*
Navicat MySQL Data Transfer
Source Server : LRC_debian
Source Server Version : 50742
Source Host : 5902e9v900.zicp.fun:33006
Source Database : expressFrame02
Target Server Type : MYSQL
Target Server Version : 50742
File Encoding : 65001
Date: 2023-10-26 12:49:35
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for clocks
-- ----------------------------
DROP TABLE IF EXISTS `clocks`;
CREATE TABLE `clocks` (
`id` bigint(20) NOT NULL,
`clockId` bigint(20) NOT NULL,
`userId` bigint(20) NOT NULL,
`text` text,
`img` text,
`music` text,
PRIMARY KEY (`id`) USING BTREE,
KEY `fk_clocks_clocks_1` (`userId`),
CONSTRAINT `fk_clocks_clocks_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`id` bigint(20) NOT NULL,
`userId` bigint(20) DEFAULT NULL,
`courseId` bigint(20) NOT NULL,
`name` text NOT NULL,
`credit` double DEFAULT NULL,
`teacher` text,
`location` text,
`remark` text,
`startTime` text NOT NULL,
`endTime` text NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `fk_course_course_1` (`userId`),
CONSTRAINT `fk_course_course_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for tasks
-- ----------------------------
DROP TABLE IF EXISTS `tasks`;
CREATE TABLE `tasks` (
`id` bigint(20) NOT NULL,
`taskId` bigint(20) NOT NULL,
`userId` bigint(20) NOT NULL,
`content` text,
`name` text NOT NULL,
`startTime` text NOT NULL,
`endTime` text NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `fk_tasks_tasks_1` (`userId`),
CONSTRAINT `fk_tasks_tasks_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for teams
-- ----------------------------
DROP TABLE IF EXISTS `teams`;
CREATE TABLE `teams` (
`id` bigint(20) NOT NULL,
`leaderId` bigint(20) NOT NULL,
`teamName` varchar(200) NOT NULL,
`maxNumber` bigint(20) DEFAULT NULL,
`introduce` text,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `teamName` (`teamName`) USING BTREE,
KEY `fk_teams_teams_1` (`leaderId`),
CONSTRAINT `fk_teams_teams_1` FOREIGN KEY (`leaderId`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint(20) NOT NULL,
`username` varchar(255) NOT NULL,
`password` text NOT NULL,
`role` bigint(20) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for userteams
-- ----------------------------
DROP TABLE IF EXISTS `userteams`;
CREATE TABLE `userteams` (
`id` bigint(20) NOT NULL,
`userId` bigint(20) NOT NULL,
`teamId` bigint(20) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `fk_userteams_userteams_1` (`userId`),
KEY `fk_userteams_userteams_2` (`teamId`),
CONSTRAINT `fk_userteams_userteams_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_userteams_userteams_2` FOREIGN KEY (`teamId`) REFERENCES `teams` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Table structure for works
-- ----------------------------
DROP TABLE IF EXISTS `works`;
CREATE TABLE `works` (
`id` bigint(20) NOT NULL,
`userId` bigint(20) NOT NULL,
`workId` bigint(20) NOT NULL,
`teamId` bigint(20) NOT NULL,
`name` text NOT NULL,
`content` text,
`status` text,
`endTime` text NOT NULL,
`startTime` text NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `fk_works_works_1` (`userId`),
KEY `fk_works_works_2` (`teamId`),
CONSTRAINT `fk_works_works_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_works_works_2` FOREIGN KEY (`teamId`) REFERENCES `teams` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;