Compare commits
2 Commits
e0bacfac1a
...
5a03323c69
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a03323c69 | |||
| 853ce79e16 |
@@ -134,7 +134,7 @@ CREATE TABLE IF NOT EXISTS posts (
|
||||
PRIMARY KEY (post_id)
|
||||
) ENGINE = MergeTree();
|
||||
|
||||
CREATE TABLE IF NOT EXISTS promote.sync_logs (
|
||||
CREATE TABLE IF NOT EXISTS sync_logs (
|
||||
timestamp DateTime DEFAULT now(),
|
||||
duration_ms UInt64,
|
||||
posts_synced UInt32,
|
||||
@@ -145,4 +145,64 @@ CREATE TABLE IF NOT EXISTS promote.sync_logs (
|
||||
error_messages String
|
||||
) ENGINE = MergeTree()
|
||||
ORDER BY
|
||||
(timestamp)
|
||||
(timestamp);
|
||||
|
||||
-- 创建专门的comments表存储评论数据
|
||||
CREATE TABLE IF NOT EXISTS comments (
|
||||
-- 基本标识信息
|
||||
comment_id String,
|
||||
-- 评论唯一ID
|
||||
post_id String,
|
||||
-- 关联的帖子ID
|
||||
user_id String,
|
||||
-- 发表评论的用户ID
|
||||
-- 时间信息
|
||||
created_at DateTime DEFAULT now(),
|
||||
-- 评论创建时间
|
||||
date Date DEFAULT toDate(created_at),
|
||||
-- 日期(用于分区)
|
||||
-- 评论内容信息
|
||||
content String,
|
||||
-- 评论内容
|
||||
sentiment_score Float64,
|
||||
-- 情感分数(-1到1)
|
||||
sentiment Enum8(
|
||||
-- 情感分类
|
||||
'positive' = 1,
|
||||
'neutral' = 2,
|
||||
'negative' = 3
|
||||
),
|
||||
-- 关联信息
|
||||
project_id String,
|
||||
-- 项目ID
|
||||
influencer_id String,
|
||||
-- 网红ID
|
||||
platform String,
|
||||
-- 评论所在平台
|
||||
-- 互动信息
|
||||
likes_count UInt32 DEFAULT 0,
|
||||
-- 点赞数量
|
||||
replies_count UInt32 DEFAULT 0,
|
||||
-- 回复数量
|
||||
-- 元数据
|
||||
parent_comment_id String DEFAULT '',
|
||||
-- 父评论ID(用于回复)
|
||||
is_reply UInt8 DEFAULT 0,
|
||||
-- 是否为回复(0=否,1=是)
|
||||
-- 同步信息
|
||||
is_synced UInt8 DEFAULT 1,
|
||||
-- 是否已同步(0=否,1=是)
|
||||
last_updated DateTime DEFAULT now(),
|
||||
-- 最后更新时间
|
||||
-- 分析信息
|
||||
keywords Array(String),
|
||||
-- 提取的关键词
|
||||
topics Array(String),
|
||||
-- 关联的话题
|
||||
-- 内部处理信息
|
||||
is_active UInt8 DEFAULT 1,
|
||||
-- 是否活跃(0=已删除/隐藏,1=活跃)
|
||||
is_spam UInt8 DEFAULT 0 -- 是否为垃圾评论(0=否,1=是)
|
||||
) ENGINE = MergeTree() PARTITION BY toYYYYMM(date)
|
||||
ORDER BY
|
||||
(post_id, created_at, comment_id) SETTINGS index_granularity = 8192;
|
||||
Reference in New Issue
Block a user