package models

import "git.apinb.com/bsm-sdk/core/database"

// post 内容相关主题表
type CmsRelateTags struct {
	ID            uint   `gorm:"primarykey"`                                                        // Id
	Identity      string `gorm:"column:identity;type:varchar(36);uniqueIndex;"`                     // 唯一标识
	PostIdentity  string `gorm:"column:post_identity;type:varchar(36);index;" json:"post_identity"` // 关联文章唯一标识
	TagsIdentity  string `gorm:"column:tags_identity;type:varchar(36);index;" json:"tags_identity"` // 关联分类唯一标识
	PagesIdentity string `gorm:"column:pages_identity;type:varchar(36);index;" json:"pages_identity"`

	Tags CmsTags `gorm:"foreignKey:Identity;references:TagsIdentity"`
}

func init() {
	database.MigrateTables = append(database.MigrateTables, &CmsRelateTags{})
}

// TableName .CmsRelateTopic 内容相关主题表
func (table *CmsRelateTags) TableName() string {
	return "cms_relate_tags" // 对应数据库表名
}
