文章和文件建立关联
This commit is contained in:
@@ -86,6 +86,7 @@ type Post struct {
|
||||
CategoryID uint `gorm:"index" json:"category_id"` // 增加索引
|
||||
Category Category `gorm:"foreignKey:CategoryID" json:"category"`
|
||||
Tags []Tag `gorm:"many2many:post_tags;" json:"tags"`
|
||||
Files []File `gorm:"many2many:post_files;" json:"files,omitempty"` // 关联文件
|
||||
Views int `gorm:"default:0" json:"views"`
|
||||
Status string `gorm:"index;size:20;default:'draft'" json:"status"` // 增加索引
|
||||
IsTop bool `gorm:"default:false" json:"is_top"`
|
||||
|
||||
Reference in New Issue
Block a user