feat: 添加自动迁移脚本并分离评论的slug和URL字段
- 新增自动数据库迁移脚本,在部署前检查并更新schema - 将post_slug字段拆分为post_slug(仅路径)和post_url(完整URL) - 更新前端widget以仅使用路径作为post_slug - 修改部署脚本以在部署前自动运行迁移
This commit is contained in:
@@ -159,13 +159,14 @@ export const postComment = async (c: Context<{ Bindings: Bindings }>) => {
|
||||
try {
|
||||
const result = await c.env.CWD_DB.prepare(`
|
||||
INSERT INTO Comment (
|
||||
created, post_slug, name, email, url, ip_address,
|
||||
created, post_slug, post_url, name, email, url, ip_address,
|
||||
os, browser, device, ua, content_text, content_html,
|
||||
parent_id, status
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`).bind(
|
||||
Date.now(),
|
||||
post_slug,
|
||||
post_url || null,
|
||||
name,
|
||||
email,
|
||||
url || null,
|
||||
|
||||
Reference in New Issue
Block a user