1.重构命名, 简化代码, 加入build.sh

2.重构数据字段结构, 使数据合理性提高.
3.测试通过openrec获取数据完整性.
TODO: 测试时区问题.
This commit is contained in:
eson
2020-07-17 18:21:38 +08:00
parent bb0f3845b7
commit e1040e69cd
15 changed files with 254 additions and 594 deletions

View File

@@ -1,29 +1,30 @@
create database if not exists `intimate_extractor`;
use intimate_extractor;
CREATE TABLE IF NOT EXISTS `anchor_info` (
CREATE TABLE IF NOT EXISTS `streamer` (
`uid` bigint AUTO_INCREMENT,
`platform` varchar(255) NOT NULL,
`anchor_id` varchar(255) NOT NULL,
`anchor_name` varchar(255) NOT NULL,
`user_id` varchar(255) NOT NULL,
`user_name` varchar(255) NOT NULL,
`live_url` text,
`channel` varchar(128) DEFAULT NULL,
`tags` json DEFAULT NULL,
`latest_log_uid` bigint,
`ext` json DEFAULT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`update_time` Timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uid`),
UNIQUE KEY `platform_anchor_id_idx` (`platform`, `anchor_id`),
UNIQUE KEY `platform_anchor_id_idx` (`platform`, `user_id`),
KEY `platform_idx` (`platform`),
KEY `anchor_id_idx` (`anchor_id`),
KEY `anchor_name_idx` (`anchor_name`),
KEY `user_id_idx` (`user_id`),
KEY `user_name_idx` (`user_name`),
KEY `channel_idx` (`channel`),
KEY `update_time_idx` (`update_time`)
);
CREATE TABLE IF NOT EXISTS `collect_log` (
`uid` bigint,
`log_uid` bigint AUTO_INCREMENT,
`streamer_uid` bigint,
`platform` varchar(255) NOT NULL,
`anchor_id` varchar(255) NOT NULL,
`user_id` varchar(255) NOT NULL,
`is_live_streaming` tinyint(1) DEFAULT 0,
`is_error` tinyint(1) DEFAULT 0,
@@ -34,17 +35,18 @@ CREATE TABLE IF NOT EXISTS `collect_log` (
`gratuity` bigint(11) DEFAULT NULL,
`live_title` text DEFAULT NULL,
`live_start_time` timestamp NULL DEFAULT NULL,
`live_end_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`live_start_time` Timestamp NULL DEFAULT NULL,
`live_end_time` Timestamp NULL DEFAULT NULL,
`update_time` Timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`tags` json DEFAULT NULL,
`ext` json DEFAULT NULL,
`error_msg` text DEFAULT NULL,
KEY `uid_idx` (`uid`),
PRIMARY KEY (`log_uid`),
KEY `streamer_uid_idx` (`streamer_uid`),
KEY `platform_idx` (`platform`),
KEY `anchor_id_idx` (`anchor_id`),
KEY `user_id_idx` (`user_id`),
KEY `is_live_streaming_idx` (`is_live_streaming`),
KEY `is_error_idx` (`is_error`),
KEY `followers_idx` (`followers`),

View File

@@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS `source_openrec` (
`source` longtext DEFAULT NULL,
`ext` json DEFAULT NULL,
`pass_gob` blob DEFAULT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`update_time` Timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`operator` int DEFAULT 0,
`error_msg` text DEFAULT NULL,
PRIMARY KEY(`uid`),