重构一下数据库

This commit is contained in:
2026-01-18 20:35:21 +08:00
parent 485307e7de
commit ff4e069a7e
20 changed files with 477 additions and 131 deletions

View File

@@ -10,15 +10,15 @@ import (
// ForumComments is the golang structure for table forum_comments.
type ForumComments struct {
Id uint64 `json:"id" orm:"id" description:"评论ID主键"` // 评论ID主键
UserId uint64 `json:"userId" orm:"user_id" description:"评论发布者ID关联users.id无外键"` // 评论发布者ID关联users.id无外键
PostId uint64 `json:"postId" orm:"post_id" description:"所属帖子ID关联forum_posts.id无外键"` // 所属帖子ID关联forum_posts.id无外键
ParentId uint64 `json:"parentId" orm:"parent_id" description:"父评论IDNULL=评论非NULL=回复某条评论)"` // 父评论IDNULL=评论非NULL=回复某条评论
Content string `json:"content" orm:"content" description:"评论内容支持emoji"` // 评论内容支持emoji
Status string `json:"status" orm:"status" description:"评论状态normal=正常 deleted=软删除 audit=审核中 reject=审核驳回"` // 评论状态normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数"` // 点赞数
ReplyCount uint `json:"replyCount" orm:"reply_count" description:"回复数(冗余字段"` // 回复数(冗余字段
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"评论创建时间"` // 评论创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"评论更新时间"` // 评论更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
Id uint64 `json:"id" orm:"id" description:"评论ID主键"` // 评论ID主键
PostId uint64 `json:"postId" orm:"post_id" description:"所属帖子ID关联 forum_posts.id无外键"` // 所属帖子ID关联 forum_posts.id无外键
UserId uint64 `json:"userId" orm:"user_id" description:"评论发布者ID关联 users.id无外键"` // 评论发布者ID关联 users.id无外键
ParentId uint64 `json:"parentId" orm:"parent_id" description:"父评论IDNULL=一级评论非NULL=二级评论指向一级评论ID无外键"` // 父评论IDNULL=一级评论非NULL=二级评论指向一级评论ID无外键
ReplyToUserId uint64 `json:"replyToUserId" orm:"reply_to_user_id" description:"回复的用户ID可选用于展示“回复@xxx”无外键"` // 回复的用户ID可选用于展示“回复@xxx”无外键
Content string `json:"content" orm:"content" description:"评论内容支持emoji"` // 评论内容支持emoji
Status string `json:"status" orm:"status" description:"状态normal=正常 deleted=软删 audit=审核中 reject=驳回"` // 状态normal=正常 deleted=软删 audit=审核中 reject=驳回
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数(冗余)"` // 点赞数(冗余)
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
}