feat: 新增CWD评论系统前后端代码及文档
refactor: 移除旧版评论系统代码并重构为Vue3前端 docs: 更新后端配置文档说明 fix: 修复评论提交频率限制和邮件通知逻辑 style: 格式化代码并优化样式 test: 添加Vitest测试配置 build: 更新依赖项和构建配置 chore: 清理无用文件和缓存
This commit is contained in:
24
cwd-comments-api/schemas/comment.sql
Normal file
24
cwd-comments-api/schemas/comment.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- create comment table
|
||||
CREATE TABLE IF NOT EXISTS Comment (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
pub_date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
post_slug TEXT NOT NULL,
|
||||
author TEXT NOT NULL,
|
||||
email TEXT NOT NULL,
|
||||
url TEXT,
|
||||
ip_address TEXT,
|
||||
device TEXT,
|
||||
os TEXT,
|
||||
browser TEXT,
|
||||
user_agent TEXT,
|
||||
content_text TEXT NOT NULL,
|
||||
content_html TEXT NOT NULL,
|
||||
parent_id INTEGER,
|
||||
status TEXT DEFAULT 'approved',
|
||||
-- 建立自引用外键约束(父子评论关系)
|
||||
FOREIGN KEY (parent_id) REFERENCES Comment (id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- 可选:为常用查询字段创建索引以提高性能
|
||||
CREATE INDEX IF NOT EXISTS idx_post_slug ON Comment(post_slug);
|
||||
CREATE INDEX IF NOT EXISTS idx_status ON Comment(status);
|
||||
Reference in New Issue
Block a user