feat: 添加多站点支持,引入site_id字段
- 在Comment表中添加site_id字段,用于区分不同站点的评论 - 更新前后端API以支持site_id参数传递 - 修改自动迁移脚本,添加site_id字段迁移逻辑 - 更新前端组件配置,支持设置siteId参数
This commit is contained in:
@@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS Comment (
|
||||
likes INTEGER NOT NULL DEFAULT 0,
|
||||
priority INTEGER NOT NULL DEFAULT 1,
|
||||
status TEXT DEFAULT 'approved',
|
||||
site_id TEXT NOT NULL DEFAULT '',
|
||||
-- 建立自引用外键约束(父子评论关系)
|
||||
FOREIGN KEY (parent_id) REFERENCES Comment (id) ON DELETE SET NULL
|
||||
);
|
||||
@@ -24,3 +25,4 @@ CREATE TABLE IF NOT EXISTS Comment (
|
||||
-- 可选:为常用查询字段创建索引以提高性能
|
||||
CREATE INDEX IF NOT EXISTS idx_post_slug ON Comment(post_slug);
|
||||
CREATE INDEX IF NOT EXISTS idx_status ON Comment(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_site_id ON Comment(site_id);
|
||||
|
||||
Reference in New Issue
Block a user