Browse Source

Add 'scheduler/src/main/resources/table.sql'

添加建表sql语句
jxing 6 years ago
parent
commit
809425218b
1 changed files with 57 additions and 0 deletions
  1. 57 0
      scheduler/src/main/resources/table.sql

+ 57 - 0
scheduler/src/main/resources/table.sql

@@ -0,0 +1,57 @@
+服务端
+库名: scheduler
+create table if not exists `task`(
+	`id` int NOT NULL AUTO_INCREMENT,
+    `task_name` varchar(100),
+    `task_cmd` text,
+    `task_param` text,
+    `task_status` int comment '0 Waiting, 1 Sending, 2 Sent, 3 FileDownloadException, 4 CommandExecuteException, 5 Finished',
+    `task_result_json` text,
+	`task_sent_time` long comment '客户端成功接收任务的时间',
+    `task_last_client` varchar(255),
+    `task_expected_finish_time` int comment '预期完成时间, 单位是s',
+	`task_add_time` timestamp DEFAULT CURRENT_TIMESTAMP,
+    PRIMARY KEY (`id`),
+	index statusIndex(task_status)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+create table if not exists `download`(
+	`id` int NOT NULL AUTO_INCREMENT,
+    `task_id` int,
+    `task_url` varchar(255),
+    `task_md5` varchar(40),
+    PRIMARY KEY (`id`),
+	index taskIdIndex(task_id)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+
+客户端
+库名: worker
+create table if not exists `task`(
+	`tid` int NOT NULL AUTO_INCREMENT,
+	`id` int NOT NULL,
+    `task_name` varchar(100),
+    `task_cmd` text,
+    `task_param` text,
+    `task_status` int comment '0 Waiting, 1 Success, -1 downloadError, -2 execute error',
+    `task_result_json` text,
+	`task_expected_finish_time` int comment '预期完成时间, 单位是s',
+	`task_add_time` timestamp DEFAULT CURRENT_TIMESTAMP,
+    PRIMARY KEY (`tid`),
+	index taskIdIndex(id),
+	index statusIndex(task_status)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+create table if not exists `download`(
+	`tid` int NOT NULL AUTO_INCREMENT,
+	`id` int NOT NULL comment '服务器端下载任务id',
+    `task_id` int,
+    `task_url` varchar(255),
+    `local_dir` text,
+    `downloaded_bytes` long,
+    `file_bytes` long,
+    `finish_time` long,
+    `task_md5` varchar(40),
+    PRIMARY KEY (`tid`),
+	index taskIdIndex(task_id)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;