课题组服务器支持两种数据库,MySQL 和 Sqlite。部署时可以选择适合自己的数据库类型。
Sqlite 数据库下载:sqlite3.zip
MySQL 数据库需要创建8个表,用于相关信息
字符编码:utf8mb4
MySQL版本:8.0 及以上版本
| eln_items | 记录; |
| eln_subtype | 记录分类; |
| eln_related | 相关记录; |
| eln_attach | 附件; |
| eln_more | 附加信息; |
| eln_sign | 签名; |
| upload_temp | 临时上传文件; |
| download_temp | 用于临时下载,外部无法访问的链接; |
eln_items
CREATE TABLE `eln_items` (
`aid` int unsigned NOT NULL AUTO_INCREMENT,
`id` bigint unsigned DEFAULT NULL,
`eln_id` int unsigned NOT NULL,
`userid` int unsigned NOT NULL,
`datetime_create` datetime NOT NULL,
`datetime_modify` datetime NOT NULL,
`datetime_locked` datetime DEFAULT NULL,
`content` json DEFAULT NULL,
`locked` tinyint unsigned NOT NULL DEFAULT '0',
`sn` varchar(45) NOT NULL,
`num` int unsigned NOT NULL,
`title` varchar(100) NOT NULL,
`version` int unsigned NOT NULL DEFAULT '1',
`comm` varchar(256) DEFAULT NULL,
`trimData` json DEFAULT NULL,
`template_id` int DEFAULT NULL,
`keywords` json DEFAULT NULL,
`projects` json DEFAULT NULL,
`valid` tinyint(1) DEFAULT '1',
`source` bigint DEFAULT '0',
`subtype` int DEFAULT '0',
`pub` tinyint(1) DEFAULT '1',
`config` json DEFAULT NULL,
PRIMARY KEY (`aid`),
UNIQUE KEY `id_UNIQUE` (`aid`),
KEY `eln` (`eln_id`),
KEY `userid` (`userid`),
KEY `bigid` (`id`)
);
eln_subtype
CREATE TABLE `eln_subtype` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`showtext` varchar(45) NOT NULL,
`eln_id` int NOT NULL,
`parent` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
eln_related
CREATE TABLE `eln_related` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`eln_id` int unsigned NOT NULL,
`item_id` bigint unsigned NOT NULL,
`related_id` bigint unsigned NOT NULL,
`related_eln` int unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
eln_attach
CREATE TABLE `eln_attach` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`url` varchar(256) NOT NULL,
`filename` varchar(256) NOT NULL,
`size` varchar(45) NOT NULL,
`item_id` bigint unsigned NOT NULL,
`hash` varchar(100) DEFAULT NULL,
`eln_id` int unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
eln_more
CREATE TABLE `eln_more` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`content` varchar(16373) NOT NULL,
`userid` int unsigned NOT NULL,
`item_id` bigint unsigned NOT NULL,
`datetime_add` datetime NOT NULL,
`eln_id` int DEFAULT NULL,
`attachs` json DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
eln_sign
CREATE TABLE `eln_sign` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`item_id` bigint unsigned NOT NULL,
`sign` varchar(400) NOT NULL,
`rsa_id` int unsigned NOT NULL,
`userid` int unsigned NOT NULL,
`datetime_sign` datetime DEFAULT NULL,
`eln_id` int DEFAULT NULL,
`sign_timestamp` varchar(400) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
upload_temp
CREATE TABLE `upload_temp` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`userid` int DEFAULT NULL,
`data` varchar(45) DEFAULT NULL,
`path` varchar(45) DEFAULT NULL,
`filename` varchar(200) DEFAULT NULL,
`unique_str` varchar(45) DEFAULT NULL,
`datetime_upload` datetime DEFAULT NULL,
`source_filename` varchar(1000) DEFAULT NULL,
`size` bigint unsigned DEFAULT '0',
`hash` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);
download_temp:用于临时下载,外部无法访问的链接
CREATE TABLE `download_temp` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`hash` varchar(100) NOT NULL,
`size` varchar(45) NOT NULL,
`url` varchar(256) NOT NULL,
`filename` varchar(256) NOT NULL,
`userid` int unsigned NOT NULL,
`date_time` datetime NOT NULL,
`token` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
);