Initial commit

This commit is contained in:
anghunk
2026-01-14 10:02:58 +08:00
commit 8f2fde5188
86 changed files with 74925 additions and 0 deletions

24
schemas/comment.sql Normal file
View 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);