intimate/sql/intimate_extractor.sql
eson 7e3b36c7d0 完成解析模块示例. 数据库入库测试.
TODO: 调整程序启动停止(非暴力关闭).
2020-07-16 15:25:55 +08:00

54 lines
1.8 KiB
SQL

create database if not exists `intimate_extractor`;
use intimate_extractor;
CREATE TABLE IF NOT EXISTS `anchor_info` (
`uid` bigint AUTO_INCREMENT,
`platform` varchar(255) NOT NULL,
`anchor_id` varchar(255) NOT NULL,
`anchor_name` varchar(255) NOT NULL,
`live_url` text,
`channel` varchar(128) DEFAULT NULL,
`tags` json DEFAULT NULL,
`ext` json DEFAULT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uid`),
UNIQUE KEY `platform_anchor_id_idx` (`platform`, `anchor_id`),
KEY `platform_idx` (`platform`),
KEY `anchor_id_idx` (`anchor_id`),
KEY `anchor_name_idx` (`anchor_name`),
KEY `channel_idx` (`channel`),
KEY `update_time_idx` (`update_time`)
);
CREATE TABLE IF NOT EXISTS `collect_log` (
`uid` bigint,
`platform` varchar(255) NOT NULL,
`anchor_id` varchar(255) NOT NULL,
`is_live_streaming` tinyint(1) DEFAULT 0,
`is_error` tinyint(1) DEFAULT 0,
`followers` bigint(11) DEFAULT NULL,
`views` bigint(11) DEFAULT NULL,
`giver` json DEFAULT NULL,
`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,
`tags` json DEFAULT NULL,
`ext` json DEFAULT NULL,
`error_msg` text DEFAULT NULL,
KEY `uid_idx` (`uid`),
KEY `platform_idx` (`platform`),
KEY `anchor_id_idx` (`anchor_id`),
KEY `is_live_streaming_idx` (`is_live_streaming`),
KEY `is_error_idx` (`is_error`),
KEY `followers_idx` (`followers`),
KEY `views_idx` (`views`),
KEY `gratuity_idx` (`gratuity`),
KEY `update_time_idx` (`update_time`)
)