package models

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

// post 关联分类表
type CmsRelateCategory 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"`         // 关联的post唯一标识
	CategoryIdentity string `gorm:"column:category_identity;type:varchar(36);index;" json:"category_identity"` // 关联的category唯一标识

	Category CmsCategory `gorm:"foreignKey:Identity;references:CategoryIdentity"`
}

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

// TableName .CmsRelateCategory 内容相关类别表
func (table *CmsRelateCategory) TableName() string {
	return "cms_relate_category" // 对应数据库表名
}
